var domain = ".jiwu.com";

var cityArray = [[11,],[]];



function setMobile(id){

	var mobile = getCookie("mobile");

	if(mobile != null){

		$("#"+id).val(mobile);

	}

}

function addFav(){

	if (document.all){  

        try{  

            window.external.addFavorite('http://www.jiwu.com/','吉屋网');  //网址与网站名称

        }catch(e){  

            alert( "加入收藏失败，请使用Ctrl+D进行添加" );  

        }  

          

    }else if (window.sidebar && window.sidebar.addPanel){  

        window.sidebar.addPanel('吉屋网', 'http://www.jiwu.com/', "");  //网站名称与网址，自行对应修改

     }else{  

        alert( "加入收藏失败，请使用Ctrl+D进行添加" );  

    }  

}

setAction();



function setAction()

{

	if(document.getElementById("form"))

	{

		document.getElementById("form").action="loupan";//add by denghui ，解决用户查询楼盘时跳转到户型的问题

	}

}

/**

 * 生成验证码图片

 * @param {Object} obj 验证码区域

 * @param {Object} obj1 重新获取验证区域

 */

function reloadcode(obj,obj1){

	$('#'+obj).html("<img  src='http://images.jiwu.com/images/loader.gif'/>");

	var img="<img style='margin-left:5px;padding:0;margin:0px; width:100px; height:30px; vertical-align: bottom;' onclick='reloadcode(\""+obj+"\",\""+obj1+"\");' border='0' id='image_code1' src='http://cs.jiwu.com/imagecode!code.action?id11="+Math.random()+"'/>";

	$('#'+obj).html(img);

	$("#"+obj1).html("<a style='color:#333' href='javascript:reloadcode(\""+obj+"\",\""+obj1+"\");'>&nbsp;&nbsp;看不清换一张</a>");

}

/**

 * 生成验证码图片

 * @param {Object} obj

 */

function reloadcode1(obj){

	$('#'+obj).html("<img  src='http://images.jiwu.com/images/loader.gif'/>");

	var img="<img onclick='reloadcode1(\""+obj+"\");' border='0' id='image_code1' src='http://cs.jiwu.com/imagecode!code.action?id11="+Math.random()+"'/>";

	$('#'+obj).html(img);

}

/**

 * 生成验证码图片

 * @param {Object} obj 验证码区域

 * @param {Object} codeName 验证码名称

 	此方法用于一个页面有多个验证码输入框

 */

function reloadcode2(obj,codeName){

	$('#'+obj).html("<img  src='http://images.jiwu.com/images/loader.gif'/>");

	var img="<img border='0' id='image_code1' src='http://cs.jiwu.com/imagecode!code.action?codeName="+codeName+"&id11="+Math.random()+"'/>";

	$('#'+obj).html(img);

}



/**

 * 公共模块，关注楼盘 默认type=0,type=1楼盘主页，type=2房价走势

 */

function addAtten(bid,bname,type){

	var batchBuilds=bid+"__"+bname;

	$.post("/comm!attBatchAtten.action",{"batchBuilds":batchBuilds,"type":type},function(data){

			if(data=="0"){

				var left = document.body.clientWidth/2;

				var right = 500;

				$("#attendinfo").css({'left':left,'top':right});

				$("#attendinfo").show();

				setTimeout(function(){$("#attendinfo").hide();},5000);

				if (type==0){};$("#ismyfav").html("已关注本楼盘");

			}else if(data=="1"){

				loginDialog();

			}else if(data=="2"){

				alert("对不起,该楼盘已经添加!");

			}else if(type==1&&data.length>2){

				//alert("恭喜您成功添加了此楼盘");

				$("#"+bid).html("[已关注]");

				$("#"+bid).attr("href","javascript:void(0);");

				$("#attendiv").html(data);

			}

			if (type==2 && data!="1"){

				$("#"+bid).html("[已关注]");

				$("#"+bid).attr("href","javascript:void(0);");

			}

	});

}



/**

 * 公共模块，置业管家留言板块的星级

 */

function advgrade(){

	var aids=$("#aids").val().split("|");

	$("div",$(".fentu_0")).removeClass("fentu_2").addClass("fentu_1");

	if ($("#scomment")){

		$("#scomment").html(aids[1]);

	}

	document.getElementById("aids").value="";

}



/**

 * 获取置业管家的评分

 * @param {Object} bid

 */

function getadvGrade(bid){

	$.post("/adv!getAviserGrade.action",{"bid":bid,"size":1},function(data){

		$("#aids").val(data);

		advgrade();

	});

}



/**

 * 公共模块，发送楼盘地址

 */

function sendMsg(){

	if(!checkMobile("contant")){

		$("#r2").css("display","");$("#r2").html("手机格式错误");

		setTimeout(function(){$("#r2").css("display","none");},2000)

		return false;

	}

	var cityId = parseInt($("#currentCityId").val());

	if ($("#currentCityId").length >0 || cityId<1) cityId = 1;

	var cookieKey = getCookieKey(cityId,$("#bid").val());

	$.post("/traffic!sendAddress.action",{"tel":$("#contant").val(),"bid":$("#bid").val(), "cookieKey":cookieKey, "brokerMobile":$("#brokerMobile").val(), "esfType":$("#esfType").val()}, function(data){

		if(data.length>0){

			if(data==1){

				$("#r2").css("display","");$("#r2").html("短信已发送，如网络延迟，未收到请稍后再试！");

				setTimeout(function(){$("#r2").css("display","none");},2000)

				if(window.location.href.indexOf("esf") > 0){

					_gaq.push(['_trackEvent','esf','address',window.location.href]);

				}else{

					_gaq.push(['_trackEvent','loupan','address',window.location.href]);

				}

			}

			if(data==0){

				$("#r2").css("display","");$("#r2").html("今日消息已发送，如遇网络繁忙可能接收失败或延迟！");

				setTimeout(function(){$("#r2").css("display","none");},2000)

			}

		}

	});

	return true;

}

//ws

//订阅价格变动信息

function order(contant, bid, type, isregister, phoneNumber, email, uname){

	if(!checkEmailValue(contant)){

		if (!checkMobileValue(contant)){

			if(!document.getElementById("r2"))alert("邮箱或是手机格式错误！");

			$("#r2").css("display","");$("#r2").html("邮箱或是手机格式错误！");

			setTimeout(function(){$("#r2").css("display","none");},2000)

			return false;

		}

	}

	var cityId = parseInt($("#currentCityId").val());

	if ($("#currentCityId").length >0 || cityId<1) cityId = 1;

	var cookieKey = getCookieKey(cityId,bid);

	$.getJSON("/price!order.action",{"contant":contant,"bid":bid, "isregister":isregister, "type":type, "phoneNumber": phoneNumber, "email":email, "uname":uname, "cookieKey":cookieKey}, function(data){

			if(isregister==0){//不需要注册弹框

				if(data.result==0){

					if(!document.getElementById("r2"))alert("订阅成功，本站会以语音电话或短信通知您楼盘动态！");

					$("#r2").css("display","");$("#r2").html("订阅成功，本站会以语音电话或短信通知您楼盘动态！");

					setTimeout(function(){$("#r2").css("display","none");},2000);

					if (type == 5){

						_gaq.push(['_trackEvent','loupan','information',window.location.href]);

					}else if (type == 2){

						_gaq.push(['_trackEvent','loupan','price',window.location.href]);

					}else if (type == 10){

						_gaq.push(['_trackEvent','esf','fangyuan',window.location.href]);

					}else if (type == 9){

						_gaq.push(['_trackEvent','esf','address',window.location.href]);

					}else if (type == 15){

						_gaq.push(['_trackEvent','esf','price',window.location.href]);

					}

				}else if(data.result==2){

					if(!document.getElementById("r2"))alert("你好，你已经订阅此信息！");

					$("#r2").css("display","");$("#r2").html("你好，你已经订阅此信息！");

					setTimeout(function(){$("#r2").css("display","none");},2000)

				}else

				{

					alert("服务器忙，订阅失败！");

				}

			}else{

				if(data.result==0){//需要注册弹框

					if(data.nid==0){

						showdiv2("updatewindow","560px","240","");

						$("#vuid").val(data.vuid);

						$("#username").val(data.username);

					}else{

						$("#r2").css("display","");$("#r2").html("订阅成功，本站会以语音电话或短信通知您楼盘动态！");

						setTimeout(function(){$("#r2").css("display","none");},3000);

					}

				}else{

					$("#r2").css("display","");$("#r2").html("你好，你已经订阅此信息！");

					setTimeout(function(){$("#r2").css("display","none");},3000);

				}



			}

		document.getElementById("contant").value="";

	});

	return true;

}

//订阅价格变动信息

function orderInfo(obj,type){

	if(!checkEmail("contant"+obj)){

		if (!checkMobile("contant"+obj)){

			$("#r1_"+obj).css("display","");$("#r1_"+obj).html("邮箱或是手机格式错误！");

			setTimeout(function(){$("#r1_"+obj).css("display","none");},3000)

			document.getElementById("contant"+obj).value="";

			return false;

		}

	}

	var binfo="";

	if(obj=="2"){

		binfo=document.getElementById("bid").value;

	}else{

		binfo=document.getElementById("bids").value;

	}

	$.getJSON("/price!orderMore.action",{"contant":$("#contant"+obj).val(),"binfo":binfo,"type":obj},function(data){

		if(type==1){//要求注册订阅

			if(data.result==0){//订阅成功

				if(data.nid==0){

					showdiv2("updatewindow","600px","240",obj);

					$("#vuid").val(data.vuid);

					$("#username").val(data.username);

				}else{

					$("#r1_"+obj).css("display","");$("#r1_"+obj).html("<span style='color:#FF0000'>订阅成功，本站会以语音电话或短信通知您楼盘动态!</span>");

					setTimeout(function(){$("#r1_"+obj).css("display","none");},3000)

				}

			}else{//订阅失败

				$("#r1_"+obj).css("display","");$("#r1_"+obj).html("你好！你已经订阅过此信息！");

				setTimeout(function(){$("#r1_"+obj).css("display","none");},3000)

			}

		}else{//不要求注册订阅

			if(data.result==0){

				$("#r1_"+obj).css("display","");$("#r1_"+obj).html("<span style='color:#FF0000'>订阅成功，本站会以语音电话或短信通知您楼盘动态!</span>");

				setTimeout(function(){$("#r1_"+obj).css("display","none");},3000)

			}else if(data.result==2){

				$("#r1_"+obj).css("display","");$("#r1_"+obj).html("你好！你已经订阅过此信息！");

				setTimeout(function(){$("#r1_"+obj).css("display","none");},3000)

			}

		}

		document.getElementById("contant"+obj).value="";

	});

	return true;

}



//订阅js(order方法重名冲突)不需要注册

function notRegisterSubscribe(contant, bid, type, isregister, phoneNumber, email, uname){

	if(!checkEmailValue(contant)){

		if (!checkMobileValue(contant)){

			if(!document.getElementById("r2"))alert("邮箱或是手机格式错误！");

			$("#r2").css("display","");$("#r2").html("邮箱或是手机格式错误！");

			setTimeout(function(){$("#r2").css("display","none");},2000)

			return false;

		}

	}

	var cityId = parseInt($("#currentCityId").val());

	if ($("#currentCityId").length >0 || cityId<1) cityId = 1;

	var cookieKey = getCookieKey(cityId,bid);

	$.getJSON("/price!order.action",{"contant":contant,"bid":bid, "isregister":isregister, "type":type, "phoneNumber": phoneNumber, "email":email, "uname":uname, "cookieKey":cookieKey}, function(data){

			if(isregister==0){//不需要注册弹框

				if(data.result==0){

					if(!document.getElementById("r2"))alert("订阅成功，本站会以语音电话或短信通知您楼盘动态");

					$("#r2").css("display","");$("#r2").html("订阅成功，本站会以语音电话或短信通知您楼盘动态！");

					setTimeout(function(){$("#r2").css("display","none");},2000);

					if (type == 5){

						_gaq.push(['_trackEvent','loupan','information',window.location.href]);

					}else if (type == 2){

						_gaq.push(['_trackEvent','loupan','price',window.location.href]);

					}else if (type == 10){

						_gaq.push(['_trackEvent','esf','fangyuan',window.location.href]);

					}else if (type == 9){

						_gaq.push(['_trackEvent','esf','address',window.location.href]);

					}else if (type == 15){

						_gaq.push(['_trackEvent','esf','price',window.location.href]);

					}

				}else if(data.result==2){

					if(!document.getElementById("r2"))alert("你好，你已经订阅此信息！");

					$("#r2").css("display","");$("#r2").html("你好，你已经订阅此信息！");

					setTimeout(function(){$("#r2").css("display","none");},2000)

				}else

				{

					alert("服务器忙，订阅失败！");

				}

			}else{

				if(data.result==0){//需要注册弹框

					if(data.nid==0){

						showdiv2("updatewindow","560px","240","");

						$("#vuid").val(data.vuid);

						$("#username").val(data.username);

					}else{

						$("#r2").css("display","");$("#r2").html("订阅成功，本站会以语音电话或短信通知您楼盘动态！");

						setTimeout(function(){$("#r2").css("display","none");},3000);

					}

				}else{

					$("#r2").css("display","");$("#r2").html("你好，你已经订阅此信息！");

					setTimeout(function(){$("#r2").css("display","none");},3000);

				}



			}

		document.getElementById("contant").value="";

	});

	return true;

}

function inintDialog(obj)

{

	var isCSS1 = /CSS1Compat/.test( document.compatMode );

    var isWebkit = /webkit/ig.test( navigator.userAgent );

    var  wrap = isCSS1 && !isWebkit  ? document.documentElement : document.body;



	var st=wrap.scrollTop;//滚动条距顶部的距离

	$("#"+obj).css({left:(screen.width-180*2)/2,top:st+150});

}



/**

 * 订阅成功弹出窗体

 * @param {Object} obj

 * @param {Object} width

 */

function showdiv2(obj,width,height,id){

	$("#"+obj).css({'left':width,'top':(($("#contant"+id).offset().top)-height),'display':''});

	$("#"+obj).fadeIn("fast");

	$("#"+obj).show();

}

function showdiv3(obj){//用户确认自动注册

	$.post("/price!userregister.action",{"vuid":$("#vuid").val(),"contant":$("#username").val()},function(data){

		if(data==0){

			$("#massage_error").html("请输入正确的手机号码！");

			setTimeout(function(){$("#massage_error").css("display","none");},3000);

		}else if(data==1){

			$("#massage_error").html("该手机号码已经被使用！");

			setTimeout(function(){$("#massage_error").css("display","none");},3000);

		}else if(data==2){

			$("#"+obj).html(" <div class='title_01'> <div class='txt'><span>用户名：</span>"+$("#username").val()+"</div><div class='txt'><span>密码：</span>888888</div> "

		       +" <div class='txt_01'>为了您的账户安全，请设置新密码。</div> </div><div class='srk'><input name='pwd' id='pwd' type='text' class='ss1' /></div>"

		     + "<div class='txt_01' id='massage_len'></div><div class='title_b'>   <div class='b_01'><a href='javascript:void(0);' onclick=\"return updatep()\">确认密码</a></div> "

		      + " <div class='b_02'><a href='javascript:void(0);' onclick='return hiddiv(\"updatewindow\")'>取消</a></div> </div> ");

			user_login_status();

		}else if(data==3){

			$("#massage_error").html("系统繁忙,请稍后再试！");

		}

	});



}

/**

 * 隐藏对应的div

 * @param {Object} obj

 */

function hiddiv(obj){

	$("#"+obj).hide();

}

//修改密码

function updatep(){

	if(!checkForm("pwd")){

		$("#massage_len").html('密码不能为空');

		setTimeout(function(){$("#massage_len").css("display","none");},2000)

		return false;

	}

	if($("#pwd").val().length > 20){

		$("#r3").html("输入的密码太长！");

		setTimeout(function(){$("#massage_len").css("display","none");},3000)

		return false;

	}

	if($("#pwd").val().length<4){

		$("#massage_len").html("密码太短了哦！");

		setTimeout(function(){$("#massage_len").css("display","none");},3000)

		return false;

	}

	$.post("/price!update.action",{"pwd":$("#pwd").val()}, function(data){

		if(data.length>0){

				$("#dup").css("display","none");

				//$("#massage_len").css("display","none");

				//$("#massage_box").html('恭喜你，修改成功');

				alert('恭喜你，修改成功');

				$("#updatewindow").hide();

		}

	});

}







//加入意向户型

function addMyfav(htid){

	$.post("/house!addMyfav.action",{"htid":htid,"bname":$("#bname").val(),"bid":$("#bid").val()}, function(data){

		if(data.length>0){

			if(data==0){

				//login

				//window.open("/user!ulogin.action");

				loginDialog();

			}

				if(data==1){

				alert('您已经添加此户型了');

			}

				if(data!=0&&data!=1){



				var arr=data.split(",");

				$("#yixiang"+htid).html("<a onclick=\"return deleMyfav("+ htid +");\"><img src=\"http://images.jiwu.com/images/huxing_04.gif\"/></a>");

				$("#myul").append("<li id=\"myf"+htid+"\"><span><a onclick=\"return deleMy\("+arr[0]+","+htid+"\)\">[取消]</a></span>"+arr[2]+"<a href=\"/dhouse!housetypeDetails.action?bid="+$("#bid").val()+"&htid="+htid+"\" target=\"_blank\">"+arr[3]+arr[4]+"</a></li>");

				}

		}

	});

}



//取消意向户型

function deleMy(mfid,htid){

	if(confirm('确定取消吗？')){

		$.post("/house!deleteMyf.action",{"mfid":mfid}, function(data){

		if(data.length>0){

			if(data==1){

				$("#yixiang"+htid).html("<a onclick=\"return addMyfav("+htid+");\"><img src=\"http://images.jiwu.com/images/huxing_03.gif\"/></a>");

				$("li").remove("#myf"+htid);

			}

			if(data=0){

				alert('取消失败');

			}

		}

	});}

}



//根据户型id取消意向户型

function deleMyfav(htid){

	   if(confirm('确定取消吗')){

		$.post("/house!deleMyfav.action",{"htid":htid}, function(data){

		if(data.length>0){

			if(data==1){

				$("li").remove("#myf"+htid);

				$("#yixiang"+htid).html("<a onclick=\"return addMyfav("+htid+");\"><img src=\"http://images.jiwu.com/images/huxing_03.gif\"/></a>");

			}

				if(data==0){

				alert('你还没登陆，不能取消');

			}

		}

	});}

}



//实现多选按钮，单选的功能

function chooseOne(cb,name){

    //先取得同name的chekcBox的集合物件

    var obj = document.getElementsByName(name);

    for (i=0; i<obj.length; i++){

        //判斷obj集合中的i元素是否為cb，若否則表示未被點選

        if (obj[i]!=cb) obj[i].checked = false;

        //若是 但原先未被勾選 則變成勾選；反之 則變為未勾選

        //else  obj[i].checked = cb.checked;

        //若要至少勾選一個的話，則把上面那行else拿掉，換用下面那行

        else obj[i].checked = true;

    }

}



//添加户型浏览次数

function addVtimes(value){

	$.post("/dhouse!addVitimes.action",{"htid":value}, function(data){



	});

}



//添加照片浏览次数

function addVtimes(value){

	$.post("/dalbum!addVitimes.action",{"pid":value}, function(data){



	});

}

function sendAdress_on(){

	if($("#tel").val() == '请输入手机号码'){

		$("#tel").val("");

		$("#tel").attr("style",function(){this.style.color="#000000";});

	}

}





function sendAdress_off(){

	if($("#tel").val() == ''){

		$("#tel").val("请输入手机号码");

		$("#tel").attr("style",function(){this.style.color="#000000";});

	}

}



function closediv(){

	$("#dup").css("display","none");

	$("#massage_len").css("display","none");

}



function order_on(){

	if($("#contant").val() == '请输入手机或Email地址'){

		$("#contant").val("");

		$("#contant").attr("style",function(){this.style.color="#000000";});

	}

}



function order_off(){

	if($("#contant").val() == ''){

		$("#contant").val("请输入手机或Email地址");

		$("#contant").attr("style",function(){this.style.color="#000000";});

	}

}

//ws





//搜索框获得焦点和失去焦点事件

function search_input_text_on(){

	if($.trim($("#name").val()) == '请输入楼盘名称'){

		$("#name").val("");

		//document.getElementById("name").className="index_ss_001";

		$("#name").attr("style",function(){this.style.color="#333";});

	}

}

function search_input_text_off(){

	if($("#name").val() == ''){

		$("#name").val("  请输入楼盘名称");

		$("#name").attr("style",function(){this.style.color="#999";});

	}

}



//问答输入框获得焦点和失去焦点事件

function wenda_input_text_on(){

    if($.trim($("#qacontent").val()) == '详细描述您的问题，有利于获得更好的回答。'){

        $("#qacontent").val("");

        $("#qacontent").attr("style",function(){this.style.color="#333";});

    }

    if($.trim($("#advcontent").val()) == '详细描述您的问题，有利于获得更好的回答。'){

        $("#advcontent").val("");

        $("#advcontent").attr("style",function(){this.style.color="#333";});

    }

}

function wenda_input_text_off(){

    if($("#qacontent").val() == ''){

        $("#qacontent").val("详细描述您的问题，有利于获得更好的回答。");

        $("#qacontent").attr("style",function(){this.style.color="#999";});

    }

    if($("#advcontent").val() == ''){

        $("#advcontent").val("详细描述您的问题，有利于获得更好的回答。");

        $("#advcontent").attr("style",function(){this.style.color="#999";});

    }

}





function SetCookie(name,value, days){

    var exp  = new Date();

    exp.setTime(exp.getTime() + days*24*60*60*1000);

    document.cookie = name + "="+ escape(value)+ ";expires=" + exp.toGMTString()+";path=/;domain="+domain;

}

function getCookie(name){

    var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));

     if(arr != null) return unescape(arr[2]); return null;

}

function delCookie(name) {

     var exp = new Date(); //当前时间

     exp.setTime(exp.getTime() - 1000);

     var cval = getCookie(name);

     if (cval != null) document.cookie = name + "='';expires=" + exp.toGMTString()+";path=/;domain="+domain;

 }



//使用正则获取当前url参数

function GetQueryString(name)

{

     var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");

     var r = window.location.search.substr(1).match(reg);

     if(r!=null)return  unescape(r[2]); return null;

}



function getHuXingDetails(myValue){

		$.post("/house!getHxdetail.action",{"myValue":myValue}, function(data){



		});

}



$(function(){  

	var fr=GetQueryString("fr");

	var utm_medium=GetQueryString("utm_medium");

	if(fr!=null&&fr!=''){

		SetCookie("fr",fr,1);

		

	}

	if(utm_medium!=null&&utm_medium!=''){

		SetCookie("utm_medium",utm_medium,1);

	}

	   

	   

});  



function changeUserName(username){

	var pattern = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/;

	var regu =/^[1][3,4,5,8][0-9]{9}$/;

	if(pattern.test(username)&& username.length>5){

		if(username.indexOf("@")>3){

			return username.substr(0,username.indexOf("@")-3)+"***"+username.substr(username.indexOf("@"));

		}else if(username.indexOf("@")==3){

			return username.substr(0,username.indexOf("@")-2)+"**"+username.substr(username.indexOf("@"));

		}else{

			return username.substr(0,username.indexOf("@")-1)+"*"+username.substr(username.indexOf("@"));

		}

	}else if (regu.test(username) && username.length == 11){

		return username.substr(0,3)+"****"+username.substr(7,11);

	}

	return username;

}





////用户登陆

//function validate_login(){

//	if(!checkForm("username")){

//		$("#r1").css("display","");$("#r1").html("用户名或者密码错误！");

//		setTimeout(function(){$("#r1").css("display","none");},3000)

//		return false;

//	}

//	if (!checkForm("password")){

//		$("#r1").css("display","");$("#r1").html("用户名或者密码错误！");

//		setTimeout(function(){$("#r1").css("display","none");},3000)

//		return false;

//	}

//	$("#form1").submit();

//}

//置业管家注册验证

function validate_registeradv(){

	if(!checkForm("email")){

		$("#r1").css("display","");$("#r1").html("请输入您的常用邮箱或手机号码！");

		setTimeout(function(){$("#r1").css("display","none");},3000)

		return false;

	}

	if(!checkEmail("email")){

		$("#r1").css("display","");$("#r1").html("输入的邮箱有误！");

		setTimeout(function(){$("#r1").css("display","none");},3000)

		return false;

	}

	if($("#email").val().length > 30){

		$("#r1").css("display","");$("#r1").html("输入的邮箱太长！");

		setTimeout(function(){$("#r1").css("display","none");},3000)

		return false;

	}

	if(!checkForm("password")){

		$("#r2").css("display","");$("#r2").html("请输入密码！");

		setTimeout(function(){$("#r2").css("display","none");},3000)

		return false;

	}

	if(!checkForm("password2")){

		$("#r3").css("display","");$("#r3").html("请输入确认密码！");

		setTimeout(function(){$("#r3").css("display","none");},3000)

		return false;

	}

	if($("#password").val().length > 20){

		$("#r3").css("display","");$("#r3").html("输入的密码太长！");

		setTimeout(function(){$("#r3").css("display","none");},3000)

		return false;

	}

	if($("#password").val().length<4){

		$("#r2").css("display","");$("#r2").html("密码太短了哦！");

		setTimeout(function(){$("#r2").css("display","none");},3000)

		return false;

	}

	if($("#password").val() != $("#password2").val()){

		$("#r3").css("display","");$("#r3").html("两次输入的密码不一致！");

		setTimeout(function(){$("#r3").css("display","none");},3000)

		return false;

	}

	if(!checkForm("mobile")){

		$("#r5").css("display","");$("#r5").html("请输入手机号码！");

		setTimeout(function(){$("#r5").css("display","none");},3000)

		return false;

	}

	if(!checkMobile("mobile")){

		$("#r5").css("display","");$("#r5").html("手机号码格式不正确！");

		setTimeout(function(){$("#r5").css("display","none");},3000)

		return false;

	}

	if(!checkForm("bname")){

		$("#r6").css("display","");$("#r6").html("请输入楼盘名称！");

		setTimeout(function(){$("#r6").css("display","none");},3000)

		return false;

	}

	if($("#bname").val().length > 20){

		$("#r6").css("display","");$("#r6").html("输入的楼盘名称太长！");

		setTimeout(function(){$("#r6").css("display","none");},3000)

		return false;

	}

	//判断邮箱

    var email = $("#email").val();var username = $("#username").val();var bname = $("#bname").val();var mobile=$("#mobile").val();

 	$.post("adviser!checkname.action", {"username":username,"email":email,"bname":bname,"mobile":mobile}, function(data) {

		if(data==1){

			$("#r4").css("display","");$("#r4").html("您输入的昵称已被使用！");

			setTimeout(function(){$("#r4").css("display","none");},3000)

		}else if(data==2){

			$("#r1").css("display","");$("#r1").html("您输入的邮箱已被使用！");

			setTimeout(function(){$("#r1").css("display","none");},3000)

		}else if(data==3){

			$("#r6").css("display","");$("#r6").html("您输入的楼盘不存在！");

			setTimeout(function(){$("#r6").css("display","none");},3000)

		}else if(data==4){

			$("#r5").css("display","");$("#r5").html("您输入的手机号码已被使用！");

			setTimeout(function(){$("#r5").css("display","none");},3000)

		}else{

			document.getElementById("regdiv").innerHTML="<a id=\"register\" href=\"#\" ><img id=\"imgreg\" src=\"http://images.jiwu.com/images/registration_01_hui.gif\" alt=\"吉屋通行证注册\" /></a>";

			$("#form1").submit();

			$("#register").attr("disabled", "disabled");

		}

	});

}

//用户注册验证

function validate_register(){

	var type=0;

	var username = $("#username").val();

	var password = $("#password").val();

	if(username=="您的手机号码或邮箱"){

		username="";

	}

	if(password=="您的密码"){

		password="";

	}

	if(username == ""){

		$("#regMsg").html("请输入您的常用邮箱或手机！");

		$("#regMsg").show();

		return false;

	}

	if($("#username").val().indexOf("@")>=0){

		if(!checkEmail("username")){

			$("#regMsg").html("输入的邮箱有误！");

			$("#regMsg").show();

			return false;

		}else{



		}

	}else{

		type=1;

		if(!checkMobile("username")){

			$("#regMsg").html("输入的手机有误！");

			$("#regMsg").show();

			return false;

		}else{



		}

	}



	if(username.length > 40){

		$("#regMsg").html("输入的邮箱太长！");

		$("#regMsg").show();

		return false;

	}

	if(password == ""){

		$("#regMsg").html("请输入密码！");

		$("#regMsg").show();

		return false;

	}

	if(password.length<4){

		$("#regMsg").html("密码太短了哦！");

		$("#regMsg").show();

		return false;

	}

	if(password.length > 20){

		$("#regMsg").html("输入的密码太长！");

		$("#regMsg").show();

		return false;

	}

 	$.post("/user!checkname.action",{"username":username}, function(data) {

		if(data==2){

			if(type==0){

				$("#regMsg").html("您输入的邮箱已被使用！");

				$("#regMsg").show();

			}else{

				$("#regMsg").html("您输入的手机号码已被使用！");

				$("#regMsg").show();

			}

		}else{

			//setTimeout(function(){$("#formreg").submit();},3000);

			$.post("/user!register.action",{"username":$("#username").val(),"password":$("#password").val(),"returnurl":$("#returnurl").val()},function(data){

				var jsonObj = $.parseJSON(data);

                var flag = jsonObj.success;

                if(flag){

                    showRegResult();

                    user_login_status();

                }else{

                    $("#regMsg").html("您可能注册失败，请尝试登陆或重新注册！");

                    $("#regMsg").show();

                }

            });

		}

	});

}



function showRegResult(){

	$("#regResult").show();

	$(".success").show();

	if($("#zc")){

		$("#zc").hide();

	}

	$("#newusername").html($("#username").val());

	setTimeout(function(){

	   $("#regResult").hide();

       $(".success").hide();

       $("#blackbg").remove();

       $("regResult").remove();

       $("blackbg").remove();

	},3000);

}

//用户注册验证

function validate_register_jiwu(){

	var type=0;

	if(!checkForm("username")){

		$("#r1").css("display","");$("#r1").html("请输入您的常用邮箱或手机！");

		setTimeout(function(){$("#r1").css("display","none");},3000)

		return false;

	}

	if($("#username").val().indexOf("@")>=0){

		if(!checkEmail("username")){

			$("#r1").css("display","");$("#r1").html("输入的邮箱有误！");

			setTimeout(function(){$("#r1").css("display","none");},3000)

			return false;

		}else{



		}

	}else{

		type=1;

		if(!checkMobile("username")){

			$("#r1").css("display","");$("#r1").html("输入的手机有误！");

			setTimeout(function(){$("#r1").css("display","none");},3000)

			return false;

		}else{



		}

	}



	if($("#username").val().length > 40){

		$("#r1").css("display","");$("#r1").html("输入的邮箱太长！");

		setTimeout(function(){$("#r1").css("display","none");},3000)

		return false;

	}

	if(!checkForm("password")){

		$("#r2").css("display","");$("#r2").html("请输入密码！");

		setTimeout(function(){$("#r2").css("display","none");},3000)

		return false;

	}

	if($("#password").val().length<4){

		$("#r2").css("display","");$("#r2").html("密码太短了哦！");

		setTimeout(function(){$("#r2").css("display","none");},3000)

		return false;

	}

	if($("#password").val().length > 20){

		$("#r2").css("display","");$("#r2").html("输入的密码太长！");

		setTimeout(function(){$("#r2").css("display","none");},3000)

		return false;

	}

 	$.post("/user!checkname.action",{"username":$("#username").val()}, function(data) {

		if(data==2){

			$("#r1").css("display","");

			if(type==0){

				$("#r1").html("您输入的邮箱已被使用！");

			}else{

				$("#r1").html("您输入的手机号码已被使用！");

			}

			setTimeout(function(){$("#r1").css("display","none");},3000)

		}else if (document.getElementById("formreg")){

			$("#formreg").submit();

		}else{

			$("#form1").submit();

		}

	});

}

//置业管家留言

function validate_adviser(a){

	var login_nid = getCookie("nid");

//	if(login_nid==null || login_nid<=0){

	if($(".v3_login").html().indexOf("退出")<0){

		newloginDialog('loupan',0);

		return;

	}

	

	checkbox("checkAdv");

	a = a==null?1:a;

	var r_id = "#r"+a;

	if(!checkForm("advcontent")){

		$(r_id).css("display","");$(r_id).html("请输入留言内容！");

		setTimeout(function(){$(r_id).css("display","none");},3000)

		return false;

	}

	if(!checkLength("advcontent", 150)){

		$(r_id).css("display","");$(r_id).html("留言内容过长！");

		setTimeout(function(){$(r_id).css("display","none");},3000)

		return false;

	}

//	var email=$.trim($("input[name='email']").val());

//	var phone=$.trim($("input[name='mobile']").val());

//	if(email.length>0){//验证邮箱

//		if(!checkEmailValue(email)){

//			$(r_id).html("请输入正确的邮箱地址！").show();

//			setTimeout(function(){$(r_id).hide();},3000);

//			return false;

//		}

//	}

//	if(phone.length>0){

//		if(!checkMobileValue(phone)){

//			$(r_id).html("请输入正确的手机号码！").show();

//			setTimeout(function(){$(r_id).hide();},3000);

//			return false;

//		}

//	}

	$("#imgbut").attr("src","http://images.jiwu.com/images/mesBut_01.gif");

	$.post("/adv!message.action",{"bid":$("#bid").val(),"content":$("#advcontent").val(),"nid":login_nid,"tonid":$("#checkAdv").val()}, function(data) {

		if(login_nid>0){

			if(data==1){

				$(r_id).css("display","");$(r_id).html("留言成功！");

				var username = changeUserName(getCookie("username"));

				$(".adviser",$("#scomment")).prepend("<div class=\"adviser_mess\"><strong>"+ username +":</strong>"+ $("#advcontent").val() +"<span class=\"time\">("+ ChangeTimeToString(new Date()) +")</span><br></div>");

				$("#advcontent").val("");$("#userName").val("");$("#email").val("");$("#mobile").val("");

				_gaq.push(['_trackEvent','loupan','message',"'"+$("#bid").val()+"'"]);

			}else{

				$(r_id).css("display","");$(r_id).html("留言失败！");

			}

		}else{

			if(data==1){

				$(r_id).css("display","");$(r_id).html("留言成功！");

				var username="吉屋网友";

				$(".adviser",$("#scomment")).prepend("<div class=\"adviser_mess\"><strong>"+ username +":</strong>"+ $("#advcontent").val() +"<span class=\"time\">("+ ChangeTimeToString(new Date()) +")</span><br></div>");

				$("#advcontent").val("");$("#userName").val("");$("#email").val("");$("#mobile").val("");

				_gaq.push(['_trackEvent','loupan','message',"'"+$("#bid").val()+"'"]);

			}else{

				$(r_id).css("display","");$(r_id).html("留言失败！");

			}

		}

		$("#imgbut").attr("src","http://images.jiwu.com/images/mesBut.jpg");

		setTimeout(function(){$(r_id).css("display","none");},3000);

	});



}

var timeoutflag = false;//30秒只能回答一次标志

//置业管家留言

function validate_adviser_new(qatype,isyuncity){

	var nid=getCookie("nid");

	  if(isyuncity==0&&(nid==null||nid<=0)){

		newloginDialog(qatype,isyuncity);

		return false;

	  }

	var login_nid = getCookie("nid");

	var r_id = "#r1";var email='';var mobile='';

	if($("#mobileoremail")){var contant = $("#mobileoremail").val();}

	if(!checkForm("advcontent") || $("#advcontent").val()=="详细描述您的问题，有利于获得更好的回答。"){

		$(r_id).css("display","");$(r_id).html("请输入留言内容！");

		setTimeout(function(){$(r_id).css("display","none");},5000)

		return false;

	}

	if(!checkLength("advcontent", 150)){

		$(r_id).css("display","");$(r_id).html("留言内容过长！");

		setTimeout(function(){$(r_id).css("display","none");},5000)

		return false;

	}

	//30秒只能回答一次

    if(timeoutflag){

        $(r_id).css("display","");$(r_id).html("您的提问速度太快了，小小的休息一下吧！");

        setTimeout(function(){$(r_id).css("display","none");},5000);

        return false;

    }

	/*if(!checkForm("mobileoremail")){

		$(r_id).css("display","");$(r_id).html("请输入手机号码或者邮箱！");

		setTimeout(function(){$(r_id).css("display","none");},5000)

		return false;

	}

	if(contant.length > 0){

		if (!checkMobileValue(contant) && !checkEmailValue(contant)){

			$(r_id).css("display","");$(r_id).html("邮箱或是手机格式错误！");

			setTimeout(function(){$(r_id).css("display","none");},5000)

			return false;

		}

		if(isNumber('mobileoremail')){

			mobile = contant;

		}else{

			email = contant;

		}

	}

	if(isyuncity>0){//运营站点需要添加验证码

		var code=getCookie("code");

		if(code!=null){

			if(code!=$("#code_input").val()){

				$(r_id).css("display","");$(r_id).html("验证码错误");

				setTimeout(function(){$(r_id).css("display","none");},5000)

				$("#auth_code").html("<img  onclick='reloadcode1(\"auth_code\");' border='0' id='image_code1' src='/imagecode!code.action?id11="+Math.random()+"'/>");

				$("#code_input").val("");

				return;

			}

		}else{

			$("#auth_code").html("<img onclick='reloadcode1(\"auth_code\");' border='0' id='image_code1' src='/imagecode!code.action?id11="+Math.random()+"'/>");

			$("#code_input").val("");

			alert("验证码错误,请再次获取验证码");

			return;

		}

	}*/

	//$("#mtijiao").html("提交中...");

    $("#newqadiv").append("<div id=\"newqaloaddiv\" class=\"butt_02_gif\"><img src=\"http://images.jiwu.com/images/loader.gif\"></div>");

    $("#newqasubdiv").attr("class","butt_02");

	$.post("/adv!newmessage.action",{"cityId":$("#cityId").val(),"bid":$("#bid").val(),"content":$("#advcontent").val(),"nid":login_nid,"tonid":$("#checkAdv").val(),"mobile":mobile,"email":email}, function(jsondata) {

		if(jsondata.length>1){

			var jsonObj = $.parseJSON(jsondata);

			var flag = jsonObj.success;

			var data = jsonObj.data;

			if(!flag){

				$(r_id).css("display","");

				$(r_id).html(data);

				$("#newqasubdiv").attr("class","butt_01");

				$("#newqaloaddiv").remove();

				setTimeout(function(){$(r_id).css("display","none");},5000);

			}else{

    			var username = changeUserName(getCookie("username"));

    			$("#newqasubdiv").attr("class","butt_01");

                $("#newqaloaddiv").remove();

                $("#advcontent").val("");$("#userName").val("");$("#mobileoremail").val("");

                $("#auth_code").html("<img  onclick='reloadcode1(\"auth_code\");' border='0' id='image_code1' src='/imagecode!code.action?id11="+Math.random()+"'/>");

                $("#code_input").val("");

                if(data.length>0 && $("#messagecontent")){

                    $("#messagecontent").prepend(data);

                    $(r_id).css("display","");$(r_id).html("提问成功！<a href='http://www.jiwu.com/wenda/"+$(data).find("#midvalue").html()+".html' target='_blank' >查看我的问题</a>");

                }else{

                	$(r_id).css("display","");$(r_id).html("提问成功！");

                }

                // _gaq.push(['_trackEvent','wenda','local',window.location.href]);

                if(qatype == "1"){

    //              _gaq.push(['_trackEvent','wenda','ask',$("#mid").val()]);

                }else{

                   // _gaq.push(['_trackEvent','loupan','message',"'"+$("#bid").val()+"'"]);

                }

                timeoutflag = true;

                setTimeout(function(){timeoutflag = false;},1000*30);

			}

		}else{

			$(r_id).css("display","");$(r_id).html("您提问过于频繁，请稍后提交问题！");

			$("#auth_code").html("<img  onclick='reloadcode1(\"auth_code\");' border='0' id='image_code1' src='/imagecode!code.action?id11="+Math.random()+"'/>");

			$("#code_input").val("");

		}

		$("#mtijiao").html("提交留言");

	});



}

 

//楼盘访问cookie记录，最多记录5个楼盘ID

function bvisitlog(bid){

	var bids = getCookie("bids");

	if (bids != null && bids != ""){

		if (bids.indexOf(bid)>=0){

			return false;

		}

		var arr = bids.split(",");

		if (arr.length==5){

			bids = bid+ "," + arr[0] + "," + arr[1] + ","+ arr[2] + ","+ arr[3];

			SetCookie("bids",bids,1);

		}else if (arr.length<5&& arr.length>=1){

			if (bids == ''){bids += bid;}

			else{bids = bid + "," + bids;}

			SetCookie("bids",bids,1);

		}

	}else{

		SetCookie("bids",bid,1);

	}

}//楼盘访问cookie记录，最多记录5个楼盘ID

function hvisitlog(htid, bid, bname, hname, room, hall, toilet){

	var htids = getCookie("htids");

	var str = htid+"|"+bid+"|"+bname+"|"+hname+"|"+room+"|"+hall+"|"+toilet;

	if (htids != null && htids != "" && str!=null){

		if (htids.indexOf(str)>=0){

			return false;

		}

		var arr = htids.split(",");

		if (arr.length==5){

			arr[0]=arr[1];

			arr[1]=arr[2];

			arr[2]=arr[3];

			arr[3]=arr[4];

			arr[4]=str;

			SetCookie("htids",arr.join(","),1);

		}else if (arr.length<5&& arr.length>=1){

			htids+=","+str;

			SetCookie("htids",htids,1);

		}

	}else{

		if(str!=null){

			SetCookie("htids",str,1);

		}

	}

}

//获得我浏览的户型

function gethvisit(){

	var htids = getCookie("htids");

	var html = "";

	if(htids!=null){

		var arr = htids.split(",");

		for(var i=0; i<arr.length; i++){

			var arr1 = arr[i].split("|");

			if(arr1.length==7){

				var str = (arr1[4]>0?"&nbsp;"+arr1[4]+"室":"")+(arr1[5]>0?arr1[5]+"厅":"")+(arr1[6]>0?arr1[6]+"卫":"");

				html += '<li><span><a href="#"></a></span><a href="/loupan/'+arr1[1]+'.html">['+arr1[2]+']</a> <a href="/huxing/'+arr1[0]+'.html">'+arr1[3]+str+'</a></li>';

			}

		}

	}else{

		html = '<li><span></span><font color="#466428">您还没有浏览任何户型</font></li>';

	}

	document.write(html);

}

//---------------------------通用验证函数开始--------------------------------



//输入非空效验

function checkForm(domid) {

	if ($("#"+domid).val().length == 0) {

		$("#"+domid).focus()

		return false;

	} else {

		return true;

	}

}

//输入长度效验

function checkLength(domid, len) {

	if ($("#"+domid).val().length > len) {

		return false;

	} else {

		return true;

	}

}

//输入日期格式效验

//如果输入的内容中包含‘-’，则按照‘-’分割来去年月日，否则直接按照位数取

function checkDate(domid) {

	if ($("#"+domid).val().length == 0) {

		return true;

	}

	var strDate = $("#"+domid).value;

	var result1 = strDate.match(/((^((1[8-9]\d{2})|([2-9]\d{3}))(-)(10|12|0?[13578])(-)(3[01]|[12][0-9]|0?[1-9])$)|(^((1[8-9]\d{2})|([2-9]\d{3}))(-)(11|0?[469])(-)(30|[12][0-9]|0?[1-9])$)|(^((1[8-9]\d{2})|([2-9]\d{3}))(-)(0?2)(-)(2[0-8]|1[0-9]|0?[1-9])$)|(^([2468][048]00)(-)(0?2)(-)(29)$)|(^([3579][26]00)(-)(0?2)(-)(29)$)|(^([1][89][0][48])(-)(0?2)(-)(29)$)|(^([2-9][0-9][0][48])(-)(0?2)(-)(29)$)|(^([1][89][2468][048])(-)(0?2)(-)(29)$)|(^([2-9][0-9][2468][048])(-)(0?2)(-)(29)$)|(^([1][89][13579][26])(-)(0?2)(-)(29)$)|(^([2-9][0-9][13579][26])(-)(0?2)(-)(29)$))/);

	if (result1 == null) {

		$("#"+domid).focus();

		return false;

	}

	return true;

}

//数值检测

function isNumber(domid) {

	if(!checkForm(domid)){

		return false;

	}

	var reg = /^[0-9]*$/;

	if(!reg.test($("#"+domid).val())){

			return false;

	}

	return true;

}

//double数值验证

function checkNum(domid) {

	if ($("#"+domid).val().length == 0) {

		return true;

	}

	var re = /^-?[1-9]*(\.\d*)?$|^-?d^(\.\d*)?$/;

	if (!re.test($("#"+domid).val())) {

		if (isNaN($("#"+domid).val())) {

			$("#"+domid).focus();

			return false;

		}

	}

	return true;

}

//验证邮箱 参数：控件ID

function checkEmail(domid){

	var pattern = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/;

		if(!pattern.test($("#"+domid).val())){

			return false;

		}

	return true;

}

//验证邮箱 参数：控件ID

function checkEmailValue(email){

	var pattern = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/;

		if(!pattern.test(email)){

			return false;

		}

	return true;

}

//手机号码 参数：控件ID

function checkMobile(domid){

	var regu =/^[1][3,4,5,8,7][0-9]{9}$/;

	if(!regu.test($("#"+domid).val())){

		return false;

	}

	if(!checkLength(domid,11)){

		return false;

	}

	return true;

}

//手机号码 参数： 手机号码

function checkMobileValue(tel){

	var regu =/^[1][4,3,5,8,7][0-9]{9}$/;

	if(!regu.test(tel)){

		return false;

	}

	if(tel.length != 11){

		return false;

	}

	return true;

}

//获取所选checkbox

function checkbox(cname) {

	var ids = "";

	var checklist = document.getElementsByName(cname);

	var ischeck;

	for (i = 0; i < checklist.length; i++) {

	if (checklist[i].checked == true) {

	if (i != checklist.length - 1) {

	ids = ids + checklist[i].value + ",";

	} else {

	ids = ids + checklist[i].value;

	}

	}

	}

	if (ids.length == 0) {

	alert("至少选择一个！");

	return false;

	}

	return true;

}

//---------------------------通用验证函数结束--------------------------------



function validate_edit_logo(a){

	var file = $('file').value;

	if(!/\.(gif|jpg|jpeg|png|GIF|JPG|PNG)$/.test(file)){

        alert("图片类型必须是.gif,jpeg,jpg,png中的一种")

        if(a==1){

        	return false;

        }

    }else{

    	var image = new Image();

    	image.src = file;

    	var height = image.height;

    	var width = image.width;

    	var fileSize = image.fileSize;

    	$('beforeend').src=file;

    	$('div_regi_right').setStyle('display', 'block');

    	if(width>80 && height>80 && fileSize>102400){

    		alert('请上传80*80像素 或者大小小于100K的图片');

    		if(a==1){

    			return false;

    		}

    	}

    	if(a==1){

    		return true;

    	}

	}

}



//编辑资料

function validate_info(){



	//判断手机checkMobile("mobile")

	if(!checkForm("mobile") || !checkMobile("mobile")){

		alert("手机格式不正确,请重新填写！");

		return false;

	}



	//判断邮箱checkEmail("email")

	/*

	if(!checkForm("email") || !checkEmail("email")){

		alert("邮箱格式不正确,请重新填写！");

		return false;

	}

	*/



	var username = $("#username").val();

 	$.getJSON("userinfo!checkname.action",{"mobile":$("#mobile").val(),"username":username}, function(data) {

		if(data.result==1){

			if(data.phone==1){

				alert("手机号码已被停用");

			}

		}else{

			$("#form1").submit();

		}

	});

}





//编辑置业管家资料

function validate_advinfo(){

	if(!checkForm("trueName")){

		$("#r1").css("display","");$("#r1").html("请输入您的真实姓名！");

		setTimeout(function(){$("#r1").css("display","none");},3000)

		return false;

	}

	if($("#nikename").val().length > 15){

		$("#r1_nikename").css("display","");$("#r1_nikename").html("昵称过长！");

		setTimeout(function(){$("#r1_nikename").css("display","none");},3000)

		return false;

	}

	if($("#trueName").val().length > 20){

		$("#r1").css("display","");$("#r1").html("输入的内容太长！");

		setTimeout(function(){$("#r1").css("display","none");},3000)

		return false;

	}

	if($("#password").val().length>0&&$("#password").val().length<4){

		$("#r2").css("display","");$("#r2").html("密码太短了哦,请输入4个以上字符！");

		setTimeout(function(){$("#r2").css("display","none");},3000)

		return false;

	}

	if($("#password").val().length > 20){

		$("#r2").css("display","");$("#r2").html("输入的内容太长！");

		setTimeout(function(){$("#r2").css("display","none");},3000)

		return false;

	}

	if(!checkMobile("mobile")){

		$("#r3").css("display","");$("#r3").html("手机格式不正确,请重新填写！");

		setTimeout(function(){$("#r3").css("display","none");},3000)

		return false;

	}

	if($("#specialty").val().length > 100){

		$("#r4").css("display","");$("#r4").html("个性签名最大长度为100个字符！");

		setTimeout(function(){$("#r4").css("display","none");},3000)

		return false;

	}

	if($("#remark").val().length > 100){

		$("#r5").css("display","");$("#r5").html("个性签名最大长度为100个字符！");

		setTimeout(function(){$("#r5").css("display","none");},3000)

		return false;

	}

	$.getJSON("userinfo!checkname.action",{"mobile":$("#mobile").val()}, function(data) {

		if(data.result==1){

			if(data.phone==1){

				$("#r5").css("display","");$("#r5").html("手机号码已被使用!");

				setTimeout(function(){$("#r5").css("display","none");},3000)

			}

		}else{

			$("#form1").submit();

		}

	});

}



function removeDialog()

{

	$("#loginDialog").remove();

}

function inintDialog()

{

	var isCSS1 = /CSS1Compat/.test( document.compatMode );

    var isWebkit = /webkit/ig.test( navigator.userAgent );

    var  wrap = isCSS1 && !isWebkit  ? document.documentElement : document.body;



	var st=wrap.scrollTop;//滚动条距顶部的距离

	$("#loginDialog").css({left:(screen.width-180*2)/2,top:st+150});

}



function ajaxLogin()

{

	var usname = $.trim($("#usname").val());

	var psw =$("#psw").val();

	if(usname == "您的手机号码或邮箱"){

		usname = "";

	}

	if(psw == "您的密码"){

		psw = "";

	}

	if(usname.length<=0)

	{

		$("#msglog").html("用户不能为空");

		$("#msglog").show();

		return;

	}

	if(psw.length<=0)

	{

		$("#msglog").html("密码不能为空");

		$("#msglog").show();

		return;

	}

	$.post("/user!ajaxLogin.action",{"username":usname,"password":psw},function(data){

		if(data==0){

            removeDialog();

            window.location.reload();

	   }else{

            $("#msglog").html("用户名或密码不正确");

            $("#msglog").show();

		}

	});

}

function scrollToCity(anchorElement, scrollElement) {

		$("#"+scrollElement).scrollTop(0);

        var anchorDom = $("#"+anchorElement);

        if (anchorDom) {

            var offsetTop = anchorDom.offset().top-184;

            $("#"+scrollElement).scrollTop(offsetTop + 10);

        }

    }

function printDiv(){

	var html='';

	html += "<div id=\"citymap_01\" >                                                                                                                      ";

html += "	<div class=\"bd\">                                                                                                                       ";

html += "		<dl>                                                                                                                                 ";

html += "			<dt>热门城市：</dt>                                                                                                              ";

html += "			<dd>                                                                                                                             ";

html += "				<a href=\"http://gz.jiwu.com/\"  target=\"_blank\" title=\"广州房产网\"><strong>广州</strong></a>                       ";

html += "               <a href=\"http://sh.jiwu.com/\"  target=\"_blank\" title=\"上海房产网\"><strong>上海</strong></a>                       ";

html += "               <a href=\"http://sz.jiwu.com/\"  target=\"_blank\" title=\"深圳房产网\"><strong>深圳</strong></a>                       ";

html += "               <a href=\"http://cs.jiwu.com/\"  target=\"_blank\" title=\"长沙房产网\"><strong>长沙</strong></a>                       ";

html += "               <a href=\"http://wh.jiwu.com/\"  target=\"_blank\" title=\"武汉房产网\"><strong>武汉</strong></a>                       ";

html += "				<a href=\"http://zz.jiwu.com/\"  target=\"_blank\" title=\"郑州房产网\"><strong>郑州</strong></a>                       ";

html += "               <a href=\"http://xa.jiwu.com/\"  target=\"_blank\" title=\"西安房产网\"><strong>西安</strong></a>                       ";

html += "               <a href=\"http://hz.jiwu.com/\"  target=\"_blank\" title=\"杭州房产网\"><strong>杭州</strong></a>                       ";

html += "				<a href=\"http://cd.jiwu.com/\"  target=\"_blank\" title=\"成都房产网\"><strong>成都</strong></a>                       ";

html += "               <a href=\"http://cq.jiwu.com/\"  target=\"_blank\" title=\"重庆房产网\"><strong>重庆</strong></a>                       ";

html += "               <a href=\"http://nn.jiwu.com/\"  target=\"_blank\" title=\"南宁房产网\"><strong>南宁</strong></a>                       ";

html += "			</dd>                                                                                                                            ";

html += "		</dl>                                                                                                                                ";

html += "	</div>                                                                                                                                   ";

html += "	<div class=\"ft\">                                                                                                                       ";

html += "		<div class=\"nav\">                                                                                           ";

html += "			<strong>按拼音首字母选择：</strong>                                                                                              ";

html += "			<ul>                                                                                                                             ";

html += "            	 <li><a onclick=\"scrollToCity('a', 'citylist');\">A</a></li>";

html += "            	 <li><a onclick=\"scrollToCity('b', 'citylist');\">B</a></li>";

html += "                <li><a onclick=\"scrollToCity('c', 'citylist');\">C</a></li>";

html += "                <li><a onclick=\"scrollToCity('d', 'citylist');\">D</a></li>";

html += "                <li><a onclick=\"scrollToCity('e', 'citylist');\">E</a></li>";

html += "                <li><a onclick=\"scrollToCity('f', 'citylist');\">F</a></li>";

html += "                <li><a onclick=\"scrollToCity('g', 'citylist');\">G</a></li>";

html += "                <li><a onclick=\"scrollToCity('h', 'citylist');\">H</a></li>";

html += "                <li><a onclick=\"scrollToCity('j', 'citylist');\">J</a></li>";

html += "                <li><a onclick=\"scrollToCity('k', 'citylist');\">K</a></li>";

html += "                <li><a onclick=\"scrollToCity('l', 'citylist');\">L</a></li>";

html += "                <li><a onclick=\"scrollToCity('m', 'citylist');\">M</a></li>";

html += "                <li><a onclick=\"scrollToCity('n', 'citylist');\">N</a></li>";

html += "                <li><a onclick=\"scrollToCity('p', 'citylist');\">P</a></li>";

html += "                <li><a onclick=\"scrollToCity('q', 'citylist');\">Q</a></li>";

html += "                <li><a onclick=\"scrollToCity('r', 'citylist');\">R</a></li>";

html += "                <li><a onclick=\"scrollToCity('s', 'citylist');\">S</a></li>";

html += "                <li><a onclick=\"scrollToCity('t', 'citylist');\">T</a></li>";

html += "                <li><a onclick=\"scrollToCity('w', 'citylist');\">W</a></li>";

html += "                <li><a onclick=\"scrollToCity('x', 'citylist');\">X</a></li>";

html += "                <li><a onclick=\"scrollToCity('y', 'citylist');\">Y</a></li>";

html += "                <li><a onclick=\"scrollToCity('z', 'citylist');\">Z</a></li>";

html += "			</ul>                                                                                                                            ";

html += "	    </div>                                                                                                                               ";

html += "  		<div class=\"list\" id=\"citylist\">                                                                                                                 ";

html += "			<dl>                                                                                                                             ";

html += "				<dt class=\"\"><a name=\"a\" id=\"a\">A</a></dt>                                                                             ";

html += "				<dd>                                                                                                                         ";

html += "				    <a href=\"http://anshan.jiwu.com/\"  target=\"_blank\" title=\"鞍山房产网\" >鞍山</a>                                         ";

html += "                   <a href=\"http://anyang.jiwu.com/\"  target=\"_blank\" title=\"安阳房产网\" >安阳</a>                                     ";

html += "                   <a href=\"http://anqing.jiwu.com/\"  target=\"_blank\" title=\"安庆房产网\" >安庆</a>                                    ";

html += "                </dd>                                                                                                                        ";

html += "			</dl>                                                                                                                            ";

html += "                                                                                                                                             ";

html += "			<dl>                                                                                                                             ";

html += "				<dt class=\"\"><a name=\"b\" id=\"b\">B</a></dt>                                                                             ";

html += "				<dd>                                                                                                                         ";

html += "				    <a title=\"包头房产网\" target=\"_blank\" href=\"http://baotou.jiwu.com/\">包头</a>                                         ";

html += "				    <a href=\"http://bj.jiwu.com/\"  target=\"_blank\" title=\"北京房产网\" >北京</a>                                         ";

html += "                   <a href=\"http://beihai.jiwu.com/\"  target=\"_blank\" title=\"北海房产网\" >北海</a>                                     ";

html += "                   <a href=\"http://baoding.jiwu.com/\"  target=\"_blank\" title=\"保定房产网\" >保定</a>                                    ";

html += "                   <a href=\"http://baoji.jiwu.com/\"  target=\"_blank\" title=\"宝鸡房产网\" >宝鸡</a>                                    ";

html += "				    <a href=\"http://bazhong.jiwu.com/\"  target=\"_blank\" title=\"巴中房产网\">巴中</a>                       ";

html += "				    <a href=\"http://bazhou.jiwu.com/\"  target=\"_blank\" title=\"巴州房产网\">巴州</a>                       ";

html += "				    <a href=\"http://binzhou.jiwu.com/\"  target=\"_blank\" title=\"滨州房产网\">滨州</a>                       ";

html += "				    <a href=\"http://bengbu.jiwu.com/\"  target=\"_blank\" title=\"蚌埠房产网\">蚌埠</a>                       ";

html += "				    <a href=\"http://benxi.jiwu.com/\"  target=\"_blank\" title=\"本溪房产网\">本溪</a>                       ";

html += "                </dd>                                                                                                                        ";

html += "			</dl>                                                                                                                            ";

html += "                                                                                                                                             ";

html += "	        <dl>                                                                                                                             ";

html += "				<dt class=\"\"><a name=\"c\" id=\"c\">C</a></dt>                                                                             ";

html += "				<dd>                                                                                                                         ";

html += "				  <a href=\"http://cs.jiwu.com/\"  target=\"_blank\" title=\"长沙房产网\" class=\"or\">长沙</a>                              ";

html += "                  <a href=\"http://cq.jiwu.com/\"  target=\"_blank\" title=\"重庆房产网\" >重庆</a>                                          ";

html += "                  <a href=\"http://cd.jiwu.com/\"  target=\"_blank\" title=\"成都房产网\" >成都</a>                                          ";

html += "                  <a href=\"http://changde.jiwu.com/\"  target=\"_blank\" title=\"常德房产网\" class=\"or\">常德</a>                         ";

html += "                  <a href=\"http://chenzhou.jiwu.com/\"  target=\"_blank\" title=\"郴州房产网\" >郴州</a>                                    ";

html += "                  <a href=\"http://cc.jiwu.com/\"  target=\"_blank\" title=\"长春房产网\">长春</a>                                           ";

html += "                  <a href=\"http://changzhou.jiwu.com/\"  target=\"_blank\" title=\"常州房产网\" >常州</a>                                   ";

html += "                   <a href=\"http://cangzhou.jiwu.com/\"  target=\"_blank\" title=\"沧州房产网\" >沧州</a>                                   ";

html += "                   <a href=\"http://chengde.jiwu.com/\"  target=\"_blank\" title=\"承德房产网\" >承德</a>                                   ";

html += "				   <a href=\"http://chizhou.jiwu.com/\"  target=\"_blank\" title=\"池州房产网\">池州</a>                       ";

html += "			     	<a href=\"http://chuzhou.jiwu.com/\"  target=\"_blank\" title=\"滁州房产网\">滁州</a>                       ";

html += "			     	<a href=\"http://changshu.jiwu.com/\"  target=\"_blank\" title=\"常熟房产网\">常熟</a>                       ";

html += "			     	<a href=\"http://chaohu.jiwu.com/\"  target=\"_blank\" title=\"巢湖房产网\">巢湖</a>                       ";

html += "			     	<a href=\"http://chaoyang.jiwu.com/\"  target=\"_blank\" title=\"朝阳房产网\">朝阳</a>                       ";

html += "			  	</dd>                                                                                                                        ";

html += "			</dl>                                                                                                                            ";

html += "			<dl>                                                                                                                             ";

html += "				<dt class=\"\"><a name=\"d\" id=\"d\">D</a></dt>                                                                             ";

html += "				<dd>                                                                                                                         ";

html += "                  <a href=\"http://dongguan.jiwu.com/\"  target=\"_blank\" title=\"东莞房产网\">东莞</a>                                     ";

html += "                  <a href=\"http://dl.jiwu.com/\"  target=\"_blank\" title=\"大连房产网\">大连</a>                                           ";

html += "                  <a href=\"http://dongying.jiwu.com/\"  target=\"_blank\" title=\"东营房产网\">东营</a>                                     ";

html += "                  <a href=\"http://deyang.jiwu.com/\"  target=\"_blank\" title=\"德阳房产网\">德阳</a>                                     ";

html += "                  <a href=\"http://dandong.jiwu.com/\"  target=\"_blank\" title=\"丹东房产网\">丹东</a>                                     ";

html += "                  <a href=\"http://daqing.jiwu.com/\"  target=\"_blank\" title=\"大庆房产网\">大庆</a>                                     ";

html += "				   <a href=\"http://dali.jiwu.com/\"  target=\"_blank\" title=\"大理房产网\">大理</a>                       ";

html += "				   <a href=\"http://datong.jiwu.com/\"  target=\"_blank\" title=\"大同房产网\">大同</a>                       ";

html += "				   <a href=\"http://dezhou.jiwu.com/\"  target=\"_blank\" title=\"德州房产网\">德州</a>                       ";

html += "				</dd>                                                                                                                        ";

html += "			</dl>                                                                                                                            ";

html += "			<dl>                                                                                                                             ";

html += "				<dt class=\"\"><a name=\"e\" id=\"e\">E</a></dt>                                                                             ";

html += "				<dd>                                                                                                                         ";

html += "                  <a href=\"http://eerduosi.jiwu.com/\"  target=\"_blank\" title=\"鄂尔多斯房产网\">鄂尔多斯</a>                             ";

html += "                  <a href=\"http://ezhou.jiwu.com/\"  target=\"_blank\" title=\"鄂州房产网\">鄂州</a>                             ";

html += "				</dd>                                                                                                                        ";

html += "			</dl>                                                                                                                            ";

html += "			<dl>                                                                                                                             ";

html += "				<dt class=\"\"><a name=\"f\" id=\"f\">F</a></dt>                                                                             ";

html += "				<dd>                                                                                                                         ";

html += "				  <a href=\"http://foshan.jiwu.com/\"  target=\"_blank\" title=\"佛山房产网\" >佛山</a>                                      ";

html += "                  <a href=\"http://fz.jiwu.com/\"  target=\"_blank\" title=\"福州房产网\">福州</a>                                           ";

html += "                  <a href=\"http://fuyang.jiwu.com/\"  target=\"_blank\" title=\"阜阳房产网\">阜阳</a>                                     ";

html += "                  <a href=\"http://fushun.jiwu.com/\"  target=\"_blank\" title=\"抚顺房产网\">抚顺</a>                                     ";

html += "                  <a href=\"http://fangchenggang.jiwu.com/\"  target=\"_blank\" title=\"防城港房产网\">防城港</a>                                     ";

html += "				</dd>                                                                                                                        ";

html += "			</dl>                                                                                                                            ";

html += "			<dl>                                                                                                                             ";

html += "				<dt class=\"\"><a name=\"g\" id=\"g\">G</a></dt>                                                                             ";

html += "				<dd>                                                                                                                         ";

html += "                    <a href=\"http://gz.jiwu.com/\"  target=\"_blank\" title=\"广州房产网\" >广州</a>                                        ";

html += "                    <a href=\"http://guilin.jiwu.com/\"  target=\"_blank\" title=\"桂林房产网\" >桂林</a>                                    ";

html += "                    <a href=\"http://gy.jiwu.com/\"  target=\"_blank\" title=\"贵阳房产网\" >贵阳</a>                                        ";

html += "                    <a href=\"http://ganzhou.jiwu.com/\"  target=\"_blank\" title=\"赣州房产网\" >赣州</a>                                   ";

html += "				</dd>                                                                                                                        ";

html += "			</dl>                                                                                                                            ";

html += "			<dl>                                                                                                                             ";

html += "				<dt class=\"\"><a name=\"h\" id=\"h\">H</a></dt>                                                                             ";

html += "				<dd>                                                                                                                         ";

html += "                    <a href=\"http://hz.jiwu.com/\"  target=\"_blank\" title=\"杭州房产网\"  class=\"or\">杭州</a>                           ";

html += "                    <a href=\"http://hf.jiwu.com/\"  target=\"_blank\" title=\"合肥房产网\">合肥</a>                                         ";

html += "                    <a href=\"http://huangshan.jiwu.com/\"  target=\"_blank\" title=\"黄山房产网\">黄山</a>                                  ";

html += "                    <a href=\"http://huangshi.jiwu.com/\"  target=\"_blank\" title=\"黄石房产网\" >黄石</a>                                  ";

html += "                    <a href=\"http://hn.jiwu.com/\"  target=\"_blank\" title=\"海南房产网\" class=\"or\">海南</a>                                        ";

html += "                    <a href=\"http://hengyang.jiwu.com/\"  target=\"_blank\" title=\"衡阳房产网\" >衡阳</a>                                  ";

html += "                    <a href=\"http://handan.jiwu.com/\"  target=\"_blank\" title=\"邯郸房产网\">邯郸</a>                                     ";

html += "                    <a href=\"http://heb.jiwu.com/\"  target=\"_blank\" title=\"哈尔滨房产网\" >哈尔滨</a>                                   ";

html += "                    <a href=\"http://huaihua.jiwu.com/\"  target=\"_blank\" title=\"怀化房产网\" >怀化</a>                                   ";

html += "                    <a href=\"http://huaian.jiwu.com/\"  target=\"_blank\" title=\"淮安房产网\" class=\"or\" >淮安</a>                                    ";

html += "                    <a href=\"http://heze.jiwu.com/\"  target=\"_blank\" title=\"菏泽房产网\" >菏泽</a>                                      ";

html += "                    <a href=\"http://huzhou.jiwu.com/\"  target=\"_blank\" title=\"湖州房产网\" >湖州</a>                                    ";

html += "                    <a href=\"http://huainan.jiwu.com/\"  target=\"_blank\" title=\"淮南房产网\" >淮南</a>                                    ";

html += "                    <a href=\"http://hhht.jiwu.com/\"  target=\"_blank\" title=\"呼和浩特房产网\" >呼和浩特</a>";

html += "                    <a href=\"http://hengshui.jiwu.com/\"  target=\"_blank\" title=\"衡水房产网\" >衡水</a>";

html += "                    <a href=\"http://huludao.jiwu.com/\"  target=\"_blank\" title=\"葫芦岛房产网\" >葫芦岛</a>";

html += "				     <a href=\"http://heyuan.jiwu.com/\"  target=\"_blank\" title=\"河源房产网\">河源</a>                       ";

html += "				     <a href=\"http://huanggang.jiwu.com/\"  target=\"_blank\" title=\"黄冈房产网\">黄冈</a>                       ";

html += "				</dd>                                                                                                                        ";

html += "			</dl>                                                                                                                            ";

html += "			<dl>                                                                                                                             ";

html += "				<dt><a name=\"j\" id=\"j\">J</a></dt>                                                                                        ";

html += "				<dd>                                                                                                                         ";

html += "                    <a href=\"http://jiangmen.jiwu.com/\"  target=\"_blank\" title=\"江门房产网\">江门</a>                                   ";

html += "                    <a href=\"http://jiangyin.jiwu.com/\"  target=\"_blank\" title=\"江阴房产网\" >江阴</a>                                  ";

html += "                    <a href=\"http://jingmen.jiwu.com/\"  target=\"_blank\" title=\"荆门房产网\">荆门</a>                                    ";

html += "                    <a href=\"http://jn.jiwu.com/\"  target=\"_blank\" title=\"济南房产网\" >济南</a>                                        ";

html += "                    <a href=\"http://jl.jiwu.com/\"  target=\"_blank\" title=\"吉林房产网\">吉林</a>                                         ";

html += "                    <a href=\"http://jiaxing.jiwu.com/\"  target=\"_blank\" title=\"嘉兴房产网\" class=\"or\">嘉兴</a>                       ";

html += "                    <a href=\"http://jinhua.jiwu.com/\"  target=\"_blank\" title=\"金华房产网\" class=\"or\">金华</a>                        ";

html += "                    <a href=\"http://jieyang.jiwu.com/\"  target=\"_blank\" title=\"揭阳房产网\" >揭阳</a>                        ";

html += "                    <a href=\"http://jining.jiwu.com/\"  target=\"_blank\" title=\"济宁房产网\" >济宁</a>                        ";

html += "                    <a href=\"http://jiujiang.jiwu.com/\"  target=\"_blank\" title=\"九江房产网\" >九江</a>                        ";

html += "                    <a href=\"http://jinzhou.jiwu.com/\"  target=\"_blank\" title=\"锦州房产网\" >锦州</a>                        ";

html += "				     <a href=\"http://jinzhong.jiwu.com/\"  target=\"_blank\" title=\"晋中房产网\">晋中</a>                       ";

html += "				     <a href=\"http://jiaozuo.jiwu.com/\"  target=\"_blank\" title=\"焦作房产网\">焦作</a>                       ";

html += "				</dd>                                                                                                                        ";

html += "			</dl>                                                                                                                            ";

html += "			<dl>                                                                                                                             ";

html += "				<dt class=\"\"><a name=\"k\" id=\"k\">K</a></dt>                                                                             ";

html += "				<dd>                                                                                                                         ";

html += "                    <a href=\"http://km.jiwu.com/\"  target=\"_blank\" title=\"昆明房产网\" >昆明</a>                                        ";

html += "                    <a href=\"http://kunshan.jiwu.com/\"  target=\"_blank\" title=\"昆山房产网\" class=\"or\">昆山</a>                       ";

html += "                    <a href=\"http://kaifeng.jiwu.com/\"  target=\"_blank\" title=\"开封房产网\">开封</a>                                    ";

html += "				</dd>                                                                                                                        ";

html += "			</dl>                                                                                                                            ";

html += "			<dl>                                                                                                                             ";

html += "				<dt class=\"\"><a name=\"l\" id=\"l\">L</a></dt>                                                                             ";

html += "				<dd>                                                                                                                         ";

html += "                    <a href=\"http://lz.jiwu.com/\"  target=\"_blank\" title=\"兰州房产网\">兰州</a>                                         ";

html += "                    <a href=\"http://liuzhou.jiwu.com/\"  target=\"_blank\" title=\"柳州房产网\" >柳州</a>                                   ";

html += "                    <a href=\"http://luoyang.jiwu.com/\"  target=\"_blank\" title=\"洛阳房产网\" >洛阳</a>                                   ";

html += "                    <a href=\"http://lyg.jiwu.com/\"  target=\"_blank\" title=\"连云港房产网\" >连云港</a>                                   ";

html += "                    <a href=\"http://leshan.jiwu.com/\"  target=\"_blank\" title=\"乐山房产网\" >乐山</a>                                    ";

html += "                    <a href=\"http://loudi.jiwu.com/\"  target=\"_blank\" title=\"娄底房产网\">娄底</a>                                      ";

html += "                    <a href=\"http://linyi.jiwu.com/\"  target=\"_blank\" title=\"临沂房产网\">临沂</a>                                      ";

html += "                    <a href=\"http://langfang.jiwu.com/\"  target=\"_blank\" title=\"廊坊房产网\">廊坊</a>                                   ";

html += "                    <a href=\"http://lishui.jiwu.com/\"  target=\"_blank\" title=\"丽水房产网\">丽水</a>                                   ";

html += "                    <a href=\"http://liaocheng.jiwu.com/\"  target=\"_blank\" title=\"聊城房产网\">聊城</a>                                   ";

html += "				     <a href=\"http://luzhou.jiwu.com/\"  target=\"_blank\" title=\"泸州房产网\">泸州</a>                       ";

html += "				     <a href=\"http://linfen.jiwu.com/\"  target=\"_blank\" title=\"临汾房产网\">临汾</a>                       ";

html += "				     <a href=\"http://liuan.jiwu.com/\"  target=\"_blank\" title=\"六安房产网\">六安</a>                       ";

html += "				     <a href=\"http://liaoyang.jiwu.com/\"  target=\"_blank\" title=\"辽阳房产网\">辽阳</a>                       ";

html += "				</dd>                                                                                                                        ";

html += "			</dl>                                                                                                                            ";

html += "			<dl>                                                                                                                             ";

html += "				<dt><a name=\"m\" id=\"m\">M</a></dt>                                                                                        ";

html += "				<dd>                                                                                                                         ";

html += "                     <a href=\"http://mianyang.jiwu.com/\"  target=\"_blank\" title=\"绵阳房产网\">绵阳</a>                                  ";

html += "                     <a href=\"http://maanshan.jiwu.com/\"  target=\"_blank\" title=\"马鞍山房产网\">马鞍山</a>                              ";

html += "                     <a href=\"http://mudanjiang.jiwu.com/\"  target=\"_blank\" title=\"牡丹江房产网\">牡丹江</a>                              ";

html += "			     	<a href=\"http://meishan.jiwu.com/\"  target=\"_blank\" title=\"眉山房产网\">眉山</a>                       ";

html += "				</dd>                                                                                                                        ";

html += "			</dl>                                                                                                                            ";

html += "			<dl>                                                                                                                             ";

html += "				<dt><a name=\"n\" id=\"n\">N</a></dt>                                                                                        ";

html += "				<dd>                                                                                                                         ";

html += "                    <a href=\"http://nn.jiwu.com/\"  target=\"_blank\" title=\"南宁房产网\">南宁</a>                                         ";

html += "                    <a href=\"http://nc.jiwu.com/\"  target=\"_blank\" title=\"南昌房产网\" >南昌</a>                                        ";

html += "                    <a href=\"http://nj.jiwu.com/\"  target=\"_blank\" title=\"南京房产网\" >南京</a>                                        ";

html += "                    <a href=\"http://nantong.jiwu.com/\"  target=\"_blank\" title=\"南通房产网\" >南通</a>                                   ";

html += "                    <a href=\"http://nanchong.jiwu.com/\"  target=\"_blank\" title=\"南充房产网\">南充</a>                                   ";

html += "                    <a href=\"http://ningbo.jiwu.com/\"  target=\"_blank\" title=\"宁波房产网\" class=\"or\">宁波</a>                        ";

html += "                    <a href=\"http://nanyang.jiwu.com/\"  target=\"_blank\" title=\"南阳房产网\" class=\"or\">南阳</a>                        ";

html += "				</dd>                                                                                                                        ";

html += "            </dl>                                                                                                                            ";

html += "			<dl>                                                                                                                             ";

html += "				<dt><a name=\"p\" id=\"p\">P</a></dt>                                                                                        ";

html += "				<dd>                                                                                                                         ";

html += "                    <a href=\"http://pingdingshan.jiwu.com/\"  target=\"_blank\" title=\"平顶山房产网\">平顶山</a>                                   ";

html += "                    <a href=\"http://panjin.jiwu.com/\"  target=\"_blank\" title=\"盘锦房产网\">盘锦</a>                            ";

html += "                    <a href=\"http://putian.jiwu.com/\"  target=\"_blank\" title=\"莆田房产网\">莆田</a>                            ";

html += "				</dd>                                                                                                                        ";

html += "			</dl>                                                                                                                            ";

html += "			<dl>                                                                                                                             ";

html += "				<dt><a name=\"q\" id=\"q\">Q</a></dt>                                                                                        ";

html += "				<dd>                                                                                                                         ";

html += "                    <a href=\"http://quanzhou.jiwu.com/\"  target=\"_blank\" title=\"泉州房产网\">泉州</a>                                   ";

html += "                    <a href=\"http://qinhuangdao.jiwu.com/\"  target=\"_blank\" title=\"秦皇岛房产网\">秦皇岛</a>                            ";

html += "                    <a href=\"http://qingdao.jiwu.com/\"  target=\"_blank\" title=\"青岛房产网\">青岛</a>                                    ";

html += "                    <a href=\"http://qingyuan.jiwu.com/\"  target=\"_blank\" title=\"清远房产网\">清远</a>                                    ";

html += "                    <a href=\"http://qujing.jiwu.com/\"  target=\"_blank\" title=\"曲靖房产网\">曲靖</a>                                    ";

html += "                    <a href=\"http://qiqihaer.jiwu.com/\"  target=\"_blank\" title=\"齐齐哈尔房产网\">齐齐哈尔</a>                                    ";

html += "                    <a href=\"http://quzhou.jiwu.com/\"  target=\"_blank\" title=\"衢州房产网\">衢州</a>                                    ";

html += "                    <a href=\"http://qinzhou.jiwu.com/\"  target=\"_blank\" title=\"钦州房产网\">钦州</a>                                    ";

html += "				</dd>                                                                                                                        ";

html += "			</dl>                                                                                                                            ";

html += "			<dl>                                                                                                                             ";

html += "				<dt><a name=\"r\" id=\"r\">R</a></dt>                                                                                        ";

html += "				<dd>                                                                                                                         ";

html += "                    <a href=\"http://rizhao.jiwu.com/\"  target=\"_blank\" title=\"日照房产网\" class=\"or\">日照</a>                                     ";

html += "				</dd>                                                                                                                        ";

html += "			</dl>                                                                                                                            ";

html += "			<dl>                                                                                                                             ";

html += "				<dt><a name=\"s\" id=\"s\">S</a></dt>                                                                                        ";

html += "				<dd>                                                                                                                         ";

html += "                    <a href=\"http://sz.jiwu.com/\"  target=\"_blank\" title=\"深圳房产网\" class=\"or\">深圳</a>                            ";

html += "                    <a href=\"http://sh.jiwu.com/\"  target=\"_blank\" title=\"上海房产网\" class=\"or\" >上海</a>                                        ";

html += "                    <a href=\"http://shantou.jiwu.com/\"  target=\"_blank\" title=\"汕头房产网\">汕头</a>                                    ";

html += "                    <a href=\"http://sjz.jiwu.com/\"  target=\"_blank\" title=\"石家庄房产网\" >石家庄</a>                                   ";

html += "                    <a href=\"http://suzhou.jiwu.com/\"  target=\"_blank\" title=\"苏州房产网\" class=\"or\">苏州</a>                        ";

html += "                    <a href=\"http://sy.jiwu.com/\"  target=\"_blank\" title=\"沈阳房产网\">沈阳</a>                                         ";

html += "                    <a href=\"http://shaoxing.jiwu.com/\"  target=\"_blank\" title=\"绍兴房产网\">绍兴</a>                                   ";

html += "                    <a href=\"http://shaoyang.jiwu.com/\"  target=\"_blank\" title=\"邵阳房产网\">邵阳</a>                                   ";

html += "                    <a href=\"http://suqian.jiwu.com/\"  target=\"_blank\" title=\"宿迁房产网\">宿迁</a>                                     ";

html += "                    <a href=\"http://shunde.jiwu.com/\"  target=\"_blank\" title=\"顺德房产网\">顺德</a>                                     ";

html += "                    <a href=\"http://shiyan.jiwu.com/\"  target=\"_blank\" title=\"十堰房产网\">十堰</a>                                     ";

html += "				     <a href=\"http://shangrao.jiwu.com/\"  target=\"_blank\" title=\"上饶房产网\">上饶</a>                       ";

html += "				     <a href=\"http://shangqiu.jiwu.com/\"  target=\"_blank\" title=\"商丘房产网\">商丘</a>                       ";

html += "				     <a href=\"http://ahsuzhou.jiwu.com/\"  target=\"_blank\" title=\"宿州房产网\">宿州</a>                       ";

html += "				     <a href=\"http://shaoguan.jiwu.com/\"  target=\"_blank\" title=\"韶关房产网\">韶关</a>                       ";

html += "                </dd>                                                                                                                        ";

html += "			</dl>                                                                                                                            ";

html += "			<dl>                                                                                                                             ";

html += "				<dt><a name=\"t\" id=\"t\">T</a></dt>                                                                                        ";

html += "				<dd>                                                                                                                         ";

html += "                    <a href=\"http://tangshan.jiwu.com/\"  target=\"_blank\" title=\"唐山房产网\" class=\"or\" >唐山</a>                                  ";

html += "                    <a href=\"http://ty.jiwu.com/\"  target=\"_blank\" title=\"太原房产网\" >太原</a>                                        ";

html += "                    <a href=\"http://taicang.jiwu.com/\"  target=\"_blank\" title=\"太仓房产网\" >太仓</a>                                   ";

html += "                    <a href=\"http://taian.jiwu.com/\"  target=\"_blank\" title=\"泰安房产网\" >泰安</a>                                   ";

html += "                    <a href=\"http://tj.jiwu.com/\"  target=\"_blank\" title=\"天津房产网\" >天津</a>                                        ";

html += "                    <a href=\"http://taizhou.jiwu.com/\"  target=\"_blank\" title=\"台州房产网\" >台州</a>                                   ";

html += "                    <a href=\"http://tz.jiwu.com/\"  target=\"_blank\" title=\"泰州房产网\">泰州</a>                                         ";

html += "                    <a href=\"http://tongling.jiwu.com/\"  target=\"_blank\" title=\"铜陵房产网\">铜陵</a>                                   ";

html += "				</dd>                                                                                                                        ";

html += "			</dl>                                                                                                                            ";

html += "			<dl>                                                                                                                             ";

html += "				<dt><a name=\"w\" id=\"w\">W</a></dt>                                                                                        ";

html += "				<dd>                                                                                                                         ";

html += "                    <a href=\"http://wuhu.jiwu.com/\"  target=\"_blank\" title=\"芜湖房产网\" >芜湖</a>                                  ";

html += "                    <a href=\"http://wh.jiwu.com/\"  target=\"_blank\" title=\"武汉房产网\" class=\"or\">武汉</a>                            ";

html += "                    <a href=\"http://wuxi.jiwu.com/\"  target=\"_blank\" title=\"无锡房产网\" >无锡</a>                                        ";

html += "                    <a href=\"http://weihai.jiwu.com/\"  target=\"_blank\" title=\"威海房产网\" >威海</a>                                   ";

html += "                    <a href=\"http://weifang.jiwu.com/\"  target=\"_blank\" title=\"潍坊房产网\">潍坊</a>                                   ";

html += "                    <a href=\"http://wlmq.jiwu.com/\"  target=\"_blank\" title=\"乌鲁木齐房产网\" >乌鲁木齐</a>                                ";

html += "                    <a href=\"http://wenzhou.jiwu.com/\"  target=\"_blank\" title=\"温州房产网\" >温州</a>                                  ";

html += "                    <a href=\"http://weinan.jiwu.com/\"  target=\"_blank\" title=\"渭南房产网\" >渭南</a>                                  ";

html += "				</dd>                                                                                                                        ";

html += "			</dl>                                                                                                                            ";

html += "			<dl>                                                                                                                             ";

html += "				<dt><a name=\"x\" id=\"x\">X</a></dt>                                                                                        ";

html += "				<dd>                                                                                                                         ";

html += "                    <a href=\"http://xiamen.jiwu.com/\"  target=\"_blank\" title=\"厦门房产网\">厦门</a>                                     ";

html += "                    <a href=\"http://xiangtan.jiwu.com/\"  target=\"_blank\" title=\"湘潭房产网\" >湘潭</a>                                  ";

html += "                    <a href=\"http://xiangyang.jiwu.com/\"  target=\"_blank\" title=\"襄阳房产网\" >襄阳</a>                                 ";

html += "                    <a href=\"http://xuzhou.jiwu.com/\"  target=\"_blank\" title=\"徐州房产网\"  >徐州</a>                                   ";

html += "                    <a href=\"http://xn.jiwu.com/\"  target=\"_blank\" title=\"西宁房产网\"  >西宁</a>                                       ";

html += "                    <a href=\"http://xa.jiwu.com/\"  target=\"_blank\" title=\"西安房产网\"  >西安</a>                                       ";

html += "                    <a href=\"http://xianyang.jiwu.com/\"  target=\"_blank\" title=\"咸阳房产网\"  >咸阳</a>                                 ";

html += "                    <a href=\"http://xinxiang.jiwu.com/\"  target=\"_blank\" title=\"新乡房产网\"  >新乡</a>                                 ";

html += "                    <a href=\"http://xinyang.jiwu.com/\"  target=\"_blank\" title=\"信阳房产网\"  >信阳</a>                                 ";

html += "                    <a href=\"http://xiaogan.jiwu.com/\"  target=\"_blank\" title=\"孝感房产网\"  >孝感</a>                                 ";

html += "                    <a href=\"http://xingtai.jiwu.com/\"  target=\"_blank\" title=\"邢台房产网\"  >邢台</a>                                 ";

html += "                    <a href=\"http://xinyu.jiwu.com/\"  target=\"_blank\" title=\"新余房产网\"  >新余</a>                                 ";

html += "				     <a href=\"http://xianning.jiwu.com/\"  target=\"_blank\" title=\"咸宁房产网\">咸宁</a>                       ";

html += "				     <a href=\"http://xuancheng.jiwu.com/\"  target=\"_blank\" title=\"宣城房产网\">宣城</a>                       ";

html += "				     <a href=\"http://xishuangbanna.jiwu.com/\"  target=\"_blank\" title=\"西双版纳房产网\">西双版纳</a>                       ";

html += "				     <a href=\"http://xuchang.jiwu.com/\"  target=\"_blank\" title=\"许昌房产网\">许昌</a>                       ";

html += "				</dd>                                                                                                                        ";

html += "			</dl>                                                                                                                            ";

html += "			<dl>                                                                                                                             ";

html += "				<dt><a name=\"y\" id=\"y\">Y</a></dt>                                                                                        ";

html += "				<dd>                                                                                                                         ";

html += "                    <a href=\"http://yancheng.jiwu.com/\"  target=\"_blank\" title=\"盐城房产网\"  >盐城</a>                                 ";

html += "                    <a href=\"http://yangzhou.jiwu.com/\"  target=\"_blank\" title=\"扬州房产网\"  >扬州</a>                                 ";

html += "                    <a href=\"http://yangjiang.jiwu.com/\"  target=\"_blank\" title=\"阳江房产网\"  >阳江</a>                                 ";

html += "                    <a href=\"http://yueyang.jiwu.com/\"  target=\"_blank\" title=\"岳阳房产网\"  >岳阳</a>                                  ";

html += "                    <a href=\"http://yichang.jiwu.com/\"  target=\"_blank\" title=\"宜昌房产网\"  >宜昌</a>                                  ";

html += "                    <a href=\"http://yichun.jiwu.com/\"  target=\"_blank\" title=\"宜春房产网\"  >宜春</a>                                  ";

html += "                    <a href=\"http://yingkou.jiwu.com/\"  target=\"_blank\" title=\"营口房产网\"  >营口</a>                                  ";

html += "                    <a href=\"http://yc.jiwu.com/\"  target=\"_blank\" title=\"银川房产网\" class=\"or\">银川</a>                            ";

html += "                    <a href=\"http://yongzhou.jiwu.com/\"  target=\"_blank\" title=\"永州房产网\"  >永州</a>                                 ";

html += "                    <a href=\"http://yantai.jiwu.com/\"  target=\"_blank\" title=\"烟台房产网\"  >烟台</a>                                   ";

html += "                    <a href=\"http://yiyang.jiwu.com/\"  target=\"_blank\" title=\"益阳房产网\"  >益阳</a>                                   ";

html += "                    <a href=\"http://yuncheng.jiwu.com/\"  target=\"_blank\" title=\"运城房产网\"  >运城</a>                                 ";

html += "                    <a href=\"http://yulin.jiwu.com/\"  target=\"_blank\" title=\"玉林房产网\"  >玉林</a>                                 ";

html += "                    <a href=\"http://yuxi.jiwu.com/\"  target=\"_blank\" title=\"玉溪房产网\"  >玉溪</a>                                 ";

html += "                    <a href=\"http://yx.jiwu.com/\"  target=\"_blank\" title=\"宜兴房产网\" class=\"or\">宜兴</a>                                 ";



html += "                </dd>                                                                                                                        ";

html += "			</dl>                                                                                                                            ";

html += "			<dl>                                                                                                                             ";

html += "				<dt><a name=\"z\" id=\"z\">Z</a></dt>                                                                                        ";

html += "				<dd>                                                                                                                         ";

html += "                    <a href=\"http://zhuhai.jiwu.com/\"  target=\"_blank\" title=\"珠海房产网\"  >珠海</a>                                   ";

html += "                    <a href=\"http://zhenjiang.jiwu.com/\"  target=\"_blank\" title=\"镇江房产网\" class=\"or\">镇江</a>                     ";

html += "                    <a href=\"http://zhongshan.jiwu.com/\"  target=\"_blank\" title=\"中山房产网\"  >中山</a>                                ";

html += "                    <a href=\"http://zhuzhou.jiwu.com/\"  target=\"_blank\" title=\"株洲房产网\"  >株洲</a>                                  ";

html += "                    <a href=\"http://zjj.jiwu.com/\"  target=\"_blank\" title=\"张家界房产网\"  >张家界</a>                                  ";

html += "                    <a href=\"http://zhangjiakou.jiwu.com/\"  target=\"_blank\" title=\"张家口房产网\" >张家口</a>                           ";

html += "                    <a href=\"http://zhanjiang.jiwu.com/\"  target=\"_blank\" title=\"湛江房产网\" >湛江</a>                                 ";

html += "                    <a href=\"http://zhaoqing.jiwu.com/\"  target=\"_blank\" title=\"肇庆房产网\" >肇庆</a>                                 ";

html += "                    <a href=\"http://zhoushan.jiwu.com/\"  target=\"_blank\" title=\"舟山房产网\"  >舟山</a>                                 ";

html += "                    <a href=\"http://zz.jiwu.com/\"  target=\"_blank\" title=\"郑州房产网\" class=\"or\">郑州</a>                            ";

html += "                    <a href=\"http://zibo.jiwu.com/\"  target=\"_blank\" title=\"淄博房产网\" class=\"or\" >淄博</a>                         ";

html += "                    <a href=\"http://zhangzhou.jiwu.com/\"  target=\"_blank\" title=\"漳州房产网\" >漳州</a>                         ";

html += "                    <a href=\"http://zunyi.jiwu.com/\"  target=\"_blank\" title=\"遵义房产网\" >遵义</a>                         ";

html += "				     <a href=\"http://zaozhuang.jiwu.com/\"  target=\"_blank\" title=\"枣庄房产网\">枣庄</a>                       ";

html += "				     <a href=\"http://zhumadian.jiwu.com/\"  target=\"_blank\" title=\"驻马店房产网\">驻马店</a>                       ";

html += "				</dd>                                                                                                                        ";

html += "			</dl>                                                                                                                            ";

html += "		</div>                                                                                                                               ";

html += "  	</div>                                                                                                                                   ";

html += "</div>                                                                                                                                       ";

	if($("#div").length > 0){

		document.getElementById("div").innerHTML=html;

	}

}

function showDiv(){

	$("#div").attr("style","");

	$("#div").removeAttr("style");

}



function hideDiv(){

	$("#div").attr("style","overflow:hidden;position:absolute");

}



/**

 * 	推广统计

 */

function statExtend(){

	var url = window.location.href;

	if(url.indexOf("opid-")>=0 && url.indexOf("qdid-")>=0 ){

		url = url.replace("&","_");

		$.ajax({

			type:"post",

			url:'/html!saveExtend.action',

			dateType:"string",

			success:function(data){



			}



		});

	}

}



/**

 * 验证手机或邮箱是否正确

 * @param {Object} id

 */

function tocheckInfo(id){

	document.getElementById("checkbutton").innerHTML="<a href=\"#\" ><div style=\"float:right; width:100px; height:32px; background:url(http://images.jiwu.com/images/tuan_back_031.gif) repeat-x; text-align:center; color:#fff; line-height:32px;\">提交</div></a>";

	var numone=0;

	if(numone==0){

		//<a href="#" onclick="tocheckInfo('email');"><div class="index_sstxt">提交</div></a>

		$("#checkbutton").html();

		numone++;

		var flag=0;

		var type=0;

		if(checkMobile(id)){//手机号码验证

			flag=1;

		}

		if(checkEmail(id)){//邮箱验证

			flag=1;

			type=1;

		}

		if(flag==0){

			$("#r3").css("display","");$("#r3").html("邮箱或手机号码格式不正确！");

			setTimeout(function(){$("#r3").css("display","none");},3000);

			numone=0;

			document.getElementById("checkbutton").innerHTML="<a href=\"#\" onclick='tocheckInfo(\"email\");' ><div style=\"float:right; width:100px; height:32px; background:url(http://images.jiwu.com/images/tuan_back_031.gif) repeat-x; text-align:center; color:#fff; line-height:32px;\">提交</div></a>";

		}else{

			$.getJSON("lostPass!sendInfo.action",{"phoneORemail":$("#"+id).val(),"type":type},function(data){

				if(data.result==-1){

					$("#r3").css("display","");$("#r3").html("您输入的手机号码不存在！");

					return "";

				}else if(data.result==2){

					$("#r3").css("display","");$("#r3").html("输入的手机号码有误！");

				}else if(data.result==1){

					$("#r3").css("display","");$("#r3").html("验证码已经发送至您手机，请三分钟后再次尝试发送！");

					$("#goCode").css("display","");

				}else if(data.result==3){

					$("#myform").submit();

				}else if(data.result==0){

					numone=0;

					window.location.href="/lostPass!toPhonePage.action";

				}

				setTimeout(function(){$("#r3").css("display","none");},3000);

				numone=0;

				//tocheckInfo('email') 

				//document.getElementById("checkbutton").innerHTML="<a href=\"#\" onclick='tocheckInfo(\"email\");' ><div class='index_sstxt'>提交</div></a>";

			});

		}

	}

}



function goCode(){

	$("#goCode").hide();

	window.location.href="/lostPass!toPhonePage.action";

}



/**

 * 填写手机验证码

 */

function confirm1(){

	var code=$("#code").val();

	if(code!=null&&code.length==6&&!isNaN(code)){

		var cook= getCookie("phoneid");

		if(cook!=null){

			if(cook.indexOf(code)>=0){

				window.location.href="/lostPass!valPhoneCode.action";

			}else{

				$("#r3").css("display","");$("#r3").html("您输入的验证码错误,请重新输入！");

			}

		}else{

			$("#r3").css("display","");$("#r3").html("您输入的验证码不存在,请重新获取！");

		}

	}else{

		$("#r3").css("display","");$("#r3").html("您输入的验证码格式错误！");

	}

	setTimeout(function(){$("#r3").css("display","none");},3000);

}



/**

 * 更新用户密码

 */

function updateInfo(){

	var pass=$("#password").val();

	if(pass!=null&&pass.length>=4){

		$("#myform").submit();

	}else{

		$("#r3").css("display","");$("#r3").html("密码格式错误,密码不少于4位！");

		setTimeout(function(){$("#r3").css("display","none");},3000);

	}

}

/**

 * 重发短信

 * @param {Object} obj

 */

function resertSendemail(obj){

	var email=$("#email").val();

	if(email!=null){

		$("#myform1").submit();

	}else{

		window.location.href="/lostPass!lostpassword.action";

	}

}



function forSendEmail(){

	var num=0;

	if(num==0){

		var flag=0

		num=1;

		var email=$("#email").val();

		var onlyemail;

		var emailvalue=$("#email_value").val();

		if(email!=null&&email.length>0){

			var str=email.split(",");

			for(var i=0;i<str.length;i++){

				var pattern = /^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+(\.[a-zA-Z0-9_-])+/;

				if(!pattern.test(str[i])){

					flag=1;

					break;

				}else{

					if(onlyemail==null){

						onlyemail=str[i];

					}else{

						if(onlyemail.indexOf(str[i])<0){

							onlyemail+=onlyemail+","+str[i];

						}

					}

				}

			}

			if(flag==0){

				$("#emailinvite").html("正在发送");

				$.post("/invite!emailInvite.action",{"email":onlyemail,"emailvalue":emailvalue,"activeName":$("#activeName").val(),"type":$("#type").val(),"trueName":$("#trueName").val(),"myinviteURL":$("#myinviteURL").val()},function(data){

						if(data=="ok"){

							$("#email_error").html("邮件发送成功!");

						}else{

							$("#email_error").html("邮件发送失败!");

						}

						num=0;

						miaoshow();

				});

			}else{

				$("#email_error").html("邮件地址格式错误！");

				num=0;

				miaoshow();

			}

		}else{

			num=0;

			$("#email_error").html("邮箱地址不能为空！");

			miaoshow();

		}

	}else{

		$("#email_error").html("系统繁忙,请勿重复提交！");

		miaoshow();

	}

}



function miaoshow(){

	$("#emailinvite").html("邀请好友");

	$("#email_error").css({"display":"block",color:"#ff6400"});

	setTimeout(function(){$("#email_error").css({"display":"none"});},3000);

	$("#email").val("");

	$("#email_value").val("");

}



function clearTexterea_on(){



	if($.trim($("#email_value").val()) == '给你好友说点什么...'){

		$("#email_value").val("");

	}

}



function clearTexterea_off(){



	if($("#email_value").val() == ''){

		$("#email_value").val("给你好友说点什么...");

	}

}

function qqbind(){

	if ($("#username").val().length==0){

		$("#tips").css("display","");$("#tips").html("用户名或密码错误！");

		setTimeout(function(){$("#tips").css("display","none");},3000)

		return;

	}

	if ($("#password").val().length==0){

		$("#tips").css("display","");$("#tips").html("用户名或密码错误！");

		setTimeout(function(){$("#tips").css("display","none");},3000)

		return;

	}

	$("#form1").submit();

}

function closetopfd(){

	document.getElementById('topfd').style.display='none';

	SetCookie("topfd",1,1);

}



/**

 * 倒计时

 * @param {Object} time 倒计时结束时间(秒)

 * @param {Object} num 增量

 */

var num=1;

function GetRTime(wtime){

	 var remainingTime  = Math.abs(wtime);

	 var nMS = remainingTime*1000 - num*1000;

	 var nD = Math.floor(nMS/(1000*60*60*24));

	 var mD = Math.floor(nMS%(1000*60*60*24));

	 var nH = Math.floor(mD/(1000*60*60));

	 var mH = Math.floor(mD%(1000*60*60));

	 var nM = Math.floor(mH/(1000*60));

	 var mM = Math.floor(mH%(1000*60));

	 var nS = Math.floor(mM/(1000));

		  $("#day").html(nD);

		  $("#hour").html(nH);

		  $("#min").html(nM);

	      $("#sed").html(nS);

	      num++;

	      if(nD+nH+nM+nS==0)

	      {

	     	 return false;//活动结束

	      }

}

/**

 * 团购或者预约信息验证 0:团购，1：预约

 */

function payinfo(type,id){

	//验证是否输入真实姓名

	if(!checkForm("truename")){

		$("#hui_r1").css("display","");$("#hui_r1").html("请输入您的真实中文姓名！");

		setTimeout(function(){$("#hui_r1").css("display","none");},3000)

		return;

	}

	//验证输入内容

	if($("#truename").val().length > 10){

		$("#hui_r1").css("display","");$("#hui_r1").html("输入的内容太长！");

		setTimeout(function(){$("#hui_r1").css("display","none");},3000)

		return ;

	}

	//判断手机checkMobile("tel")

	if(!checkMobile("mobile")){

		$("#hui_r2").css("display","");$("#hui_r2").html("手机格式不正确,请重新填写！");

		setTimeout(function(){$("#hui_r2").css("display","none");},3000)

		return;

	}

	if(type==3){

		//验证邮箱

		if(!checkEmail("email")){

			$("#hui_r3").css("display","");$("#hui_r3").html("邮箱格式不正确！");

			setTimeout(function(){$("#hui_r3").css("display","none");},3000)

			return;

		}

		//验证邮箱长度

		if($("#email").val().length > 100){

			$("#hui_r3").css("display","");$("#hui_r3").html("输入的内容太长！");

			setTimeout(function(){$("#hui_r3").css("display","none");},3000);

			return;

		}

	}

	//验证备注长度

	if($("#remark").val()){

		if($("#remark").val().length > 100){

		$("#hui_r5").css("display","");$("#hui_r5").html("个性签名最大长度为100个字符！");

		setTimeout(function(){$("#hui_r5").css("display","none");},3000)

		return;

		}

	}

	//预约验证时间有效性

	if(type==3){//预约

		var t=document.getElementById("htime");

		var type=t.options[t.selectedIndex].value;

		//验证日期格式

		var objRegExp = /^\d{4}(\-|\/|\.)\d{1,2}\1\d{1,2}$/;

		if(!objRegExp.test($("#etime").val())) {

			$("#r4").css("display","");$("#r4").html("日期格式不正确！");

			setTimeout(function(){$("#r4").css("display","none");},3000)

			return;

		}

		$.post("/hui!getTime.action",{"ytime":$("#etime").val()+" "+type,"id":id},function(data){

			if(data==1){

				$("#yuetime").attr("value",$("#etime").val()+" "+type);

				_gaq.push(['_trackEvent','jiwuhui','join',id]);

				document.myform.submit(); //提交表单信息

			}else{

				$("#r4").css("display","");$("#r4").html("日期超过期限！");

				setTimeout(function(){$("#r4").css("display","none");},3000);

			}

		});

	}else{//团购

		_gaq.push(['_trackEvent','jiwuhui','join',id]);

		document.myform.submit();//提交表单信息

	}

}



var addvipusernum=0;

function addvipuser(bname,bid){

	if(addvipusernum==0){

		addvipusernum=1;

		var uname=$("#uname").val();

		var phone=$("#phoneNumber").val();

		var email=$("#email").val();

		var remark=$("#remark").val();

		var cityId=$("#cityId").val();



		if(!checkForm("uname") || $("#uname").val()=="输入您的姓名"){

			$("#error").html('请输入您的真实姓名！').show();

			setTimeout(function(){$("#error").css("display","none");},2000);

			addvipusernum=0;

			return;

		}

		if(uname!=null&&uname.length>10){

			$("#error").html("姓名输入的内容太长！").show();

			setTimeout(function(){$("#error").css("display","none");},2000);

			addvipusernum=0;

			return;

		}

		//判断手机checkMobile("tel")

		if(!checkMobile("phoneNumber")){

			$("#error").html("手机格式不正确,请重新填写！").show();

			setTimeout(function(){$("#error").css("display","none");},2000);

			addvipusernum=0;

			return;

		}

		var phonetel=getCookie(phone+"_"+bid);

		if(phonetel!=null&&phonetel.length>0){//验证用户是否在十天内是否重复报名

			$("#error").html("你已报名此活动，请勿重复报名！").show();

			setTimeout(function(){$("#error").css("display","none");},2000);

			addvipusernum=0;

			return;

		}

		if($("#email").val().length>0&&!checkEmail("email")){//邮箱验证

			$("#error").html("邮箱格式不正确！").show();

			setTimeout(function(){$("#error").css("display","none");},2000);

			addvipusernum=0;

			return;

		}

		if($("#remark").val()=="" || $("#remark").val()=="详细描述您的购房需求，有利于得到更周到的服务。"){

			$("#error").html("请输入购房需求！").show();

			setTimeout(function(){$("#error").css("display","none");},2000);

			addvipusernum=0;

			return;

		}

		if($("#remark").val().length>25){

			$("#error").html("输入内容太长！").show();

			setTimeout(function(){$("#error").css("display","none");},2000);

			addvipusernum=0;

			return;

		}

		if($("#remark").val().length<6){

			$("#error").html("输入内容太短！").show();

			setTimeout(function(){$("#error").css("display","none");},2000);

			addvipusernum=0;

			return;

		}

		$.post("/vipuser!addvipuser.action",{"name":uname,"phoneNumber":phone,"email":email,"remark":remark,"bname":bname,"bid":bid,"cityId":cityId,"type":1},function(data){

			if(data==1){//报名成功

				SetCookie(phone+"_"+bid,phone+"_"+bid,864000);

				if ($("#error_sec").length>0)

				{

					$("#error_sec").html("恭喜你，活动报名成功").show();

					trungrouppage(bid,1,"");

					setTimeout(function(){$("#error_sec").css("display","none");},2000);

				}

				else

				{

					$("#error").html("恭喜你，活动报名成功").show();

					setTimeout(function(){$("#error").css("display","none");},2000);

				}



				if ($("#tuan_content").length>0)

				{

					$.post("/vipuser!ajaxOrder.action",{"bid":bid},function(data){

						$("#tuan_content").css("display","block");

						$("#tuan_content_tit").css("display","block");

						$("#tuan_content").html(data);

					});

				}

				_gaq.push(['_trackEvent','loupan','tuangou',"'"+bid+"'"]);

			}else{

				$("#error").html("报名失败，请稍后再试！").show();

				setTimeout(function(){$("#error").css("display","none");},2000);

			}

			$("#uname").attr("value","");

			$("#phoneNumber").attr("value","");

			$("#email").attr("value","");

			$("#remark").attr("value","");

			addvipusernum=0;

		});

	}else{

		$("#error").html("请勿重复提交！").show();

		setTimeout(function(){$("#error").css("display","none");},2000);

	}



}

function ChangeTimeToString(DateIn)

    {

        var Year=0;

        var Month=0;

        var Day=0;

        var Hour = 0;

        var Minute = 0;

        var CurrentDate="";



        //初始化时间

        Year      = DateIn.getFullYear();

        Month     = DateIn.getMonth()+1;

        Day       = DateIn.getDate();

        Hour      = DateIn.getHours();

        Minute    = DateIn.getMinutes();





        CurrentDate = Year + "-";

        if (Month >= 10 )

        {

            CurrentDate = CurrentDate + Month + "-";

        }

        else

        {

            CurrentDate = CurrentDate + "0" + Month + "-";

        }

        if (Day >= 10 )

        {

            CurrentDate = CurrentDate + Day ;

        }

        else

        {

            CurrentDate = CurrentDate + "0" + Day ;

        }



         if(Hour >=10)

        {

            CurrentDate = CurrentDate + " " + Hour ;

        }

        else

        {

            CurrentDate = CurrentDate + " 0" + Hour ;

        }

        if(Minute >=10)

        {

            CurrentDate = CurrentDate + ":" + Minute ;

        }

        else

        {

            CurrentDate = CurrentDate + ":0" + Minute ;

        }

        return CurrentDate;

    }

function inintBMDialog(){

	$('#bmdialog').show();

	 var sp_height = $(document).height()//获取当期窗口的高度

	 var sp_width = $(document).width()//获取当期窗口的宽度

	 $(".sp_box").css({"opacity":"0.5","height":sp_height,"width":sp_width})//锁屏层高度采用获取窗口的高度，从而达到锁全屏的目的。

	 $(".sp_box").show()//显示锁屏层，此时锁屏层的宽在CSS里设置了100%



	$("#bmclose").click(function(){//点击关闭时候

		$("#bmdialog").hide()//弹出提示层消失

		$(".sp_box").hide()//锁屏层消失

	})

	var st=$(document).scrollTop();//滚动条距顶部的距离

	var screenwidth,screenheight,mytop,getPosLeft,getPosTop,screenwidth = $(window).width();

	　　$("#bmdialog").css({left:(screen.width-240*2)/2,top:st+100});

	　　$(window).resize(function(){

			$("#bmdialog").css({left:(screen.width-240*2)/2,top:st+100});

	　　});



	　$(window).scroll(function(){

		$("#bmdialog").css({left:(screen.width-240*2)/2,top:100+$(document).scrollTop()});

	　　});

	//if(!$.browser.msie) {

	var isCSS1 = /CSS1Compat/.test( document.compatMode );

    var isWebkit = /webkit/ig.test( navigator.userAgent );

    var  wrap = isCSS1 && !isWebkit  ? document.documentElement : document.body;

	$("#bmdialog").css({left:(screen.width-240*2)/2,top:st+100});

	//}

}

function getSearchWord(){

	var refer=document.referrer;

	var sosuo=refer.split(".")[1];

	var grep=null;

	var str=null;

	var keyword=null;

	if(sosuo=='baidu'){

		grep=/wd\=.*\&/i;

		str=refer.match(grep)

		keyword=str.toString().split("=")[1].split("&")[0];

		return decodeURIComponent(keyword)

	}

}

function isIE6(){

	 if(navigator.userAgent.indexOf("MSIE 6.0")>0){

		 return true;

	 }

	 return false;

}



function getCookieKey(cityId, bid)

{

	var uid = getCookie("nid");

    if(uid==null){

	    var name = "cookie_key";

	    uid = getCookie(name);

	    if(uid==null){

		    var value = "";

		    for(var i=0;i<8;i++)

			    value += Math.floor(Math.random()*10);

		    var exp = new Date();

		    exp.setTime(exp.getTime() + 3650*24*60*60*1000);

		    document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString()+";path=/"+";domain=.jiwu.com";

		    uid = value;

	    }

    }

    return uid;

}

function browserRedirect() {

   var sUserAgent= navigator.userAgent.toLowerCase();

   var bIsIphoneOs= sUserAgent.match(/iphone os/i) == "iphone os";

   var bIsMidp= sUserAgent.match(/midp/i) == "midp";

   var bIsUc7= sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";

   var bIsUc= sUserAgent.match(/ucweb/i) == "ucweb";

   var bIsAndroid= sUserAgent.match(/android/i) == "android";

   var bIsCE= sUserAgent.match(/windows ce/i) == "windows ce";

   var bIsWM= sUserAgent.match(/windows mobile/i) == "windows mobile";

   var hidecv = getCookie("hidecv");

   if(hidecv==2){

	   return false;

   }

   if(sUserAgent.indexOf("android") >= 0){

	   return true;

   }

   if (bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM ) {

   	return true;

   } else {

   	return false;

   }

}



//让指定的DIV显示在屏幕正中间

function showMobileConfirm(url){

	var hidecv = getCookie("hidecv");

	if(hidecv == null){

		if(confirm("切换到专业手机版，浏览更加节省流量、更快捷！")){

			_gaq.push(['_trackEvent','pcchange','mobile','ok']);

			window.location.href=url;

			SetCookie("hidecv",1,1);

		}else{

			_gaq.push(['_trackEvent','pcchange','mobile','cancel']);

			SetCookie("hidecv",2,1);

		}

	}else if(hidecv == 1){

		_gaq.push(['_trackEvent','pcchange','mobile','ok']);

		window.location.href=url;

	}

}

function jsonpcallback(data){

	if(data!=null && data.result == 0){

		for(var i=0; i<data.Agentonline.length; i++){

			var jid = data.Agentonline[i].jid;

			var type = data.Agentonline[i].type;

			if(parseInt(type) == 0){

				$("a[name='jjr"+jid+"']").attr("title","当前在线");

				$("a[name='jjr"+jid+"']").attr("class","schat");

				 document.getElementById("jjr"+jid).style.display = "none";

			}else if(parseInt(type) == 1){

				$("a[name='jjr"+jid+"']").attr("title","当前手机在线");

				$("a[name='jjr"+jid+"']").attr("class","schat");

				document.getElementById("jjr"+jid).style.display = "none";

			}

			$("a[name='jjr"+jid+"']").show();

		}

	}

}

//发短信窗口

function showNavigationDiv()

{

		$("#xy").css({'left':$(this).offset().left,'top':$(this).offset().top});

		$("#bnamesms").html($(this).attr("bname").replace(new RegExp("&quot","gm"),"\""));

		$("#buildaddress").html($.trim($(this).attr("address")));

		$("#sendmsg").html("<div onclick=\"sendAdress("+$.trim($(this).attr("bid"))+")\" style=\"background:url(http://images.jiwu.com/images/maps_03.gif) no-repeat; width:69px; overflow:hidden; color:#fff; line-height:29px; text-align:center; font-size:14px;\">发送</div>");

		$("#xy").fadeIn("fast");

}



//售楼处主页在线聊天

function home_chatstart(jid,jname,fid,usr){

	_gaq.push(['_trackEvent','loupan','IM',window.location.href+"("+jid+")"]);

	LazyLoad.css("http://images.jiwu.com/css2.0/onlinetalk.css",function(){chatstart(jid,jname,fid,usr);});

}



//经纪人模块在线聊天

function jjr_chatstart(jid,jname,fid,usr){

    LazyLoad.css("http://images.jiwu.com/css2.0/onlinetalk.css",function(){chatstart(jid,jname,fid,usr);});

}



/**

 * 增加百度事件统计

 * @param key

 * @param name 可为空，为空时name=key

 */

function addStatBaiduEvent(key, name) {

	//console.log((name || key) + "_" + getCityDomain());

	_hmt.push(['_trackEvent', 'PC', key, (name || key) + "_" + getCityDomain()]);

}



function addStatBaiduEventOk(key, name) {

	//console.log("ok	" + (name || key) + "_" + getCityDomain());

	_hmt.push(['_trackEvent', 'PC', key + "_ok", (name || key) + "_" + getCityDomain()]);

}



/**

 * 获得domain

 */

function getCityDomain() {

	return window.location.host.split(".")[0];

}



/**

 * 获得楼盘销售状态名称

 * @param saleStatus

 */

function getBuildSaleStatuName(saleStatus) {

	//机器站点状态情况 // 即将开盘 -11在售 -12待售 -13 售完-14 出租-15 租售 -17新盘首开- 18 老盘加推- 19尾盘  

	var salestatusStr = "";

	if(saleStatus == 276) {

		salestatusStr ="在售";

	} else if(saleStatus == 277	) {

		salestatusStr ="待售";

	} else if(saleStatus == 278) {

		salestatusStr ="售完";

	} else if(saleStatus == 908) {

		salestatusStr ="现房";

	} else if(saleStatus == 909) {

		salestatusStr ="尾盘";

	}else {

		salestatusStr ="售完";   

	}

	return salestatusStr;

}



//显示验证码

function showCheckCode(sucFunc) {

	$("#checkCodeDialog").remove();

	$("body").append(

		'<div id="checkCodeDialog">' + 

			'<div id="mask" onclick="$(this).parent().remove()" style="position: fixed; text-align: center; left: 0; top: 0; width: 100%; height: 100%; background: url(http://images.jiwu.com/images/v4.0/black.png); overflow: auto; z-index: 99999;"></div>' + 

			'<div id="popup-captcha-mobile" style="position: fixed; left: 50%; top: 50%; margin: -108px 0 0 -130px; z-index: 100000; height: 216px; overflow: hidden;"></div>' + 

		'</div>'

	);

	

	var handlerEmbed = function (captchaObj) {

        captchaObj.appendTo("#popup-captcha-mobile");

        captchaObj.onSuccess(function () {

            var validate = captchaObj.getValidate();

            if(sucFunc) {

                sucFunc(validate);

            }

            $("#checkCodeDialog").remove();

        });

    };

    

    $.ajax({

        // 获取id，challenge，success（是否启用failback）

        url: "http://" + location.hostname + "/user!startCaptcha.action?t=" + (new Date()).getTime(), // 加随机数防止缓存

        type: "get",

        dataType: "json",

        success: function (data) {

            // 使用initGeetest接口

            // 参数1：配置参数

            // 参数2：回调，回调的第一个参数验证码对象，之后可以使用它做appendTo之类的事件

            initGeetest({

                gt: data.gt,

                challenge: data.challenge,

                product: "embed", // 产品形式，包括：float，embed，popup。注意只对PC版验证码有效

                offline: !data.success // 表示用户后台检测极验服务器是否宕机，一般不需要关注

                // 更多配置参数请参见：http://www.geetest.com/install/sections/idx-client-sdk.html#config

            }, handlerEmbed);

        }

    });

}
